Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example of querying the YQL console.
import restkit
import simplejson
YQL_URL = ('http://query.yahooapis.com', '/v1/public/yql')
value = '11215'
pmr = restkit.Resource(YQL_URL[0])
query = 'SELECT * FROM geo.places WHERE text = "%s"'
qs = value.replace(r'"', r'\"')
response = pmr.post(
path = YQL_URL[1],
format = 'json',
q = query % qs
)
s = response.body_string()
b = simplejson.loads(s)
print b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment