Skip to content

Commit

Permalink
Merge pull request #5131 from openstates/pa-fix-duplicate-bill-parse
Browse files Browse the repository at this point in the history
PA: attempt to fix duplicate vote events in scrape
  • Loading branch information
jessemortenson authored Dec 12, 2024
2 parents 5647243 + f108386 commit 73765ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scrapers/pa/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@ def scrape_session(self, chamber, session, special=0):
url = utils.bill_list_url(chamber, session, special)
page = self.get_page(url)

# PA website repeats some bills on the listing page
# ex: resolutions that are also concurrent resolutions
bill_urls_seen = []

RETRY_TIMES = 5
for link in page.xpath('//a[@class="bill"]'):
is_parsed = False
for retry_time in range(0, RETRY_TIMES):
try:
yield from self.parse_bill(chamber, session, special, link)
if link.attrib["href"] not in bill_urls_seen:
bill_urls_seen.append(link.attrib["href"])
yield from self.parse_bill(chamber, session, special, link)
is_parsed = True

break
except Exception as e:
self.logger.warning(
Expand Down

0 comments on commit 73765ff

Please sign in to comment.