From 1d930b70f444fa02288451f41514482dd70e65d3 Mon Sep 17 00:00:00 2001 From: showerst Date: Thu, 16 Jan 2025 17:22:16 -0500 Subject: [PATCH] MT: fix for vote pointing to bad action id (#5227) --- scrapers/mt/bills.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scrapers/mt/bills.py b/scrapers/mt/bills.py index f28a680ca4..2f41ffc0fd 100644 --- a/scrapers/mt/bills.py +++ b/scrapers/mt/bills.py @@ -470,7 +470,7 @@ def scrape_votes_page(self, vote_url: str, bill: Bill): passed = counts["YES"] > counts["NO"] # regular vs committee votes - if "billStatus" in row: + if "billStatus" in row and row["billStatus"] and "id" in row["billStatus"]: bill_action = self.actions_by_id[str(row["billStatus"]["id"])] chamber = ( "lower" @@ -490,8 +490,19 @@ def scrape_votes_page(self, vote_url: str, bill: Bill): == "HOUSE" else "upper" ) - bill_action = self.actions_by_id[str(row["billStatusId"])] + if str(row["billStatusId"]) in self.actions_by_id: + bill_action = self.actions_by_id[str(row["billStatusId"])] + else: + self.warning( + f"Unable to find bill action {str(row['billStatusId'])}" + ) + bill_action = None when = dateutil.parser.parse(row["voteTime"]) + else: + self.error( + f"Found MT vote with neither an action nor a meeting. {vote_url}" + ) + continue when = self.tz.localize(when) vote_id = f"{bill.legislative_session}-{bill.identifier}-{str(row['id'])}"