Skip to content

Instantly share code, notes, and snippets.

@philchristensen
Created April 29, 2013 19:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philchristensen/5484156 to your computer and use it in GitHub Desktop.
Save philchristensen/5484156 to your computer and use it in GitHub Desktop.
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