Skip to content

Commit

Permalink
Merge pull request #5116 from openstates/mo-handle-xml-parse-error
Browse files Browse the repository at this point in the history
MO: prevent xml parse error from killing scrape job
  • Loading branch information
jessemortenson authored Dec 5, 2024
2 parents 18ba34d + d82b629 commit 5adfabf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scrapers/mo/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,13 @@ def _scrape_lower_chamber(self, session):
bill_id = f"{bill_type} {bill_num}"

bill_content = self.get(bill_url)
ib_response = lxml.etree.fromstring(bill_content.content)
try:
ib_response = lxml.etree.fromstring(bill_content.content)
except lxml.etree.XMLSyntaxError:
self.logger.error(
f"Error parsing XML for bill {bill_num} at {bill_url}"
)
continue

yield from self.parse_house_bill(
ib_response, bill_id, bill_year, bill_code, session
Expand Down

0 comments on commit 5adfabf

Please sign in to comment.