def college_scorecard(): ''' Get a boatload of college information about some schools Study the Data Dictionary here: https://collegescorecard.ed.gov/assets/CollegeScorecardDataDictionary.xlsx ''' URL = 'https://api.data.gov/ed/collegescorecard/v1/schools.json?school.degrees_awarded.predominant=2,3&fields=id,school.name,2013.student.size&api_key=pfJKDXPzTykVL73ehnPyY8pkDQLjfq5cz5LqCkl3' response = requests.get(URL) json_string = response.content parsed_json = json.loads(json_string) # Now we have a python dictionary dictionary_utilities.iterate_dictionary(parsed_json)
def get_art_info_from_smithsonian(): ''' Get information about a work of art. The work of art is identified by a uuid in the URL variable, below. https://smithsonian.github.io/api-docs/#/SAAM ''' URL = 'https://api.si.edu/saam/v1/artworks/dd19ac03-04e8-4d20-bfe9-ecfc238ebd54' response = requests.get( URL, params={}, headers={'X-Api-Key': 'pfJKDXPzTykVL73ehnPyY8pkDQLjfq5cz5LqCkl3'}) json_string = response.content parsed_json = json.loads(json_string) # Now we have a python dictionary dictionary_utilities.iterate_dictionary(parsed_json)
def get_candidates(): ''' https://api.open.fec.gov/developers/#/candidate/get_candidate__candidate_id__ https://godoc.org/github.com/tmc/openfec Also interesting: https://www.fec.gov/data/browse-data/?tab=bulk-data ''' URL = 'https://api.open.fec.gov/v1/candidates/?page=99' response = requests.get( URL, params={}, headers={'X-Api-Key': 'pfJKDXPzTykVL73ehnPyY8pkDQLjfq5cz5LqCkl3'}) json_string = response.content parsed_json = json.loads(json_string) # Now we have a python dictionary # print (parsed_json) results = parsed_json['results'] dictionary_utilities.iterate_dictionary(parsed_json)