Skip to content

Commit

Permalink
OK events: swallow exceptions for 404s on agenda PDFs
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Nov 29, 2024
1 parent 5dc3ee1 commit 56b5c86
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scrapers/ok/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from openstates.exceptions import EmptyScrape

from utils.events import match_coordinates
from scrapelib import HTTPError
from spatula import PdfPage, URL

bills_re = re.compile(
Expand All @@ -18,6 +19,13 @@


class Agenda(PdfPage):
def process_error_response(self, exception):
# OK has some known 404s for PDFs, so swallow those exceptions
if isinstance(exception, HTTPError):
self.logger.warning(f"Skipped PDF download due to to HTTPError {exception}")
else:
raise exception

def process_page(self):
# Find all bill ids
bills = bills_re.findall(self.text)
Expand Down

0 comments on commit 56b5c86

Please sign in to comment.