From d68da693a4609c08bc94ef121b616d377a1cc4f2 Mon Sep 17 00:00:00 2001 From: Tim Showers Date: Tue, 18 Oct 2016 10:20:10 -0400 Subject: [PATCH] Allow for DC bills without sponsor info --- openstates/dc/bills.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openstates/dc/bills.py b/openstates/dc/bills.py index b7f2d54cb7..ece13978e5 100644 --- a/openstates/dc/bills.py +++ b/openstates/dc/bills.py @@ -50,6 +50,7 @@ def scrape(self, session, chambers): while len(data) > 0: for bill in data: + bill_versions = [] #sometimes they're in there more than once, so we'll keep track bill_id = bill["Title"] @@ -76,12 +77,18 @@ def scrape(self, session, chambers): bill = Bill(session,"upper", bill_id, title, type=bill_type) #sponsors and cosponsors - introducers = legislation_info["Introducer"] + try: + #sometimes there are sponsors, sometimes not. + introducers = legislation_info["Introducer"] + except KeyError: + introducers = [] + try: #sometimes there are cosponsors, sometimes not. cosponsors = legislation_info["CoSponsor"] except KeyError: cosponsors = [] + for i in introducers: sponsor_name = i["Name"] #they messed up Phil Mendelson's name