Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lametro/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from .secrets import TOKEN

LOGGER = logging.getLogger(__name__)

class LametroBillScraper(LegistarAPIBillScraper, Scraper):
BASE_URL = 'https://webapi.legistar.com/v1/metro'
BASE_WEB_URL = 'https://metro.legistar.com'
Expand Down Expand Up @@ -165,7 +167,7 @@ def scrape(self, window=28, matter_ids=None) :

matter_id = matter['MatterId']

date = matter['MatterIntroDate']
date = matter['MatterAgendaDate']
title = matter['MatterTitle']
identifier = matter['MatterFile']

Expand Down Expand Up @@ -270,13 +272,16 @@ def scrape(self, window=28, matter_ids=None) :
for relation in self.relations(matter_id):
try:
# Get data (i.e., json) for the related bill.
# Then, we can find the 'MatterFile' (i.e., identifier) and the 'MatterIntroDate' (i.e., to determine its legislative session).
# Then, we can find the 'MatterFile' (i.e., identifier) and the 'MatterAgendaDate' (i.e., to determine its legislative session).
# Sometimes, the related bill does not yet exist: in this case, throw an error, and continue.
related_bill = self.endpoint('/matters/{0}', relation['MatterRelationMatterId'])
except scrapelib.HTTPError:
continue
else:
date = related_bill['MatterIntroDate']
try:
date = related_bill['MatterAgendaDate']
except AttributeError:
raise AttributeError('Bill with MatterId {} has no MatterAgendaDate'.(matter_id))
related_bill_session = self.session(self.toTime(date))
identifier = related_bill['MatterFile']
bill.add_related_bill(identifier=identifier,
Expand Down