From 30dd9b2bcd29d55c8e4d6f798009778114f99f1b Mon Sep 17 00:00:00 2001 From: "Christopher T. Johnson" Date: Thu, 27 Feb 2025 10:22:20 -0500 Subject: [PATCH] Process 404 returns correctly. Fixes: #20 --- workers.py | 4 ++++ 1 file changed, 4 insertions(+) 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)