Skip to content

Instantly share code, notes, and snippets.

@edsu edsu/bills.py
Last active Apr 13, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.