Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (24 sloc) 0.943 kb
import sys
from collections import namedtuple
import requests
class APIObject(object):
API Objects pulls data and stores the response.
def __init__(self, api_url, api_key):
self.url = '%s?api_key=%s' % (api_url, api_key)
self.response = requests.get(self.url) = self.response.json()
if __name__ == "__main__":
Run APIObject from the commandline:
$ python put_your_api_key_here
The first arg is the api_url. The second is your API_KEY.
$ python $API_URL $API_KEY
Where $API_URL is the url that you want to hit and $API_KEY is replaced with your API_KEY.
If you would like to capture the output run the following:
$ python 'data/Arms/Surveys' $API_KEY > output.json
import pprint
ap = APIObject(sys.argv[1], sys.argv[2])
Jump to Line
Something went wrong with that request. Please try again.