Skip to content

Instantly share code, notes, and snippets.

@edsu
Last active April 13, 2019 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsu/413368f80ad3ad205c2397831bf5bd41 to your computer and use it in GitHub Desktop.
Save edsu/413368f80ad3ad205c2397831bf5bd41 to your computer and use it in GitHub Desktop.
import json
import requests
# get maryland's current house members
key = "your_key_here"
headers = {"X-API-KEY": key}
url = 'https://api.propublica.org/congress/v1/members/house/md/current.json'
resp = requests.get(url, headers=headers)
members = resp.json()
# for each member look up what legislation they've introduced in this congress
for member in members['results']:
url = 'https://api.propublica.org/congress/v1/members/' + member['id'] + '/bills/introduced.json'
resp = requests.get(url, headers=headers)
bills = resp.json()
print(member['name'])
for bill in bills['results'][0]['bills']:
if bill['congress'] == '116':
print(' - ' + bill['title'], bill['congressdotgov_url'])
print('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment