Last active
April 13, 2019 18:28
-
-
Save edsu/413368f80ad3ad205c2397831bf5bd41 to your computer and use it in GitHub Desktop.
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 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