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'])}"