Created
July 9, 2012 18:08
-
-
Save eads/3077965 to your computer and use it in GitHub Desktop.
Python reference script for Socrata inline query API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
url = "https://data.cityofchicago.org/api/views/INLINE/rows.json?method=getRows&start=0&length=10" | |
post = { 'originalViewId' : 'ijzp-q8t2', 'name' : 'inline filter' } | |
resp1 = requests.post(url, data=post) # Form encoded post payload | |
resp2 = requests.post(url, data=json.dumps(post)) # JSON encoded post payload | |
# -- Output -- | |
# In [14]: resp1.content | |
# Out[14]: '{\n "code" : "invalid_request",\n "error" : true,\n "message" : "The view was not included in the post for an INLINE method call"\n}\n' | |
# In [15]: resp2.content | |
# Out[15]: '{\n "code" : "invalid_request",\n "error" : true,\n "message" : "The view was not included in the post for an INLINE method call"\n}\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment