diff --git a/workers.py b/workers.py index 67fddb1..fff0585 100644 --- a/workers.py +++ b/workers.py @@ -129,12 +129,16 @@ def update_db(case_id: str, db: QSqlDatabase) -> int: r = requests.get( f"https://www.supremecourt.gov/docket/docketfiles/html/public/{case_id}.html" ) + if r.status_code == 404: + return -1 + if r.status_code != 200: print(r.status_code) exit(1) bs = BeautifulSoup(r.text, "lxml") # # SCOTUS does not return 404 for page not found. + # Feb 27: SCOTUS is returning 404s but I don't trust them. # title = bs.find("title") assert isinstance(title, Tag) and isinstance(title.string, str)