]> git.phdru.name Git - bookmarks_db.git/commitdiff
Feat(Robots/bkmk_rrequests): Report 40x and 50x errors
authorOleg Broytman <phd@phdru.name>
Sun, 3 Mar 2024 20:41:54 +0000 (23:41 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 3 Mar 2024 20:48:32 +0000 (23:48 +0300)
Robots/bkmk_rrequests.py

index f0d04dae377cd16f0d1e4194e0a43b8a190168fc..08fe09ebcd830725ebb54263a7d28f7b36d8e79d 100644 (file)
@@ -84,4 +84,7 @@ def request_get(url, headers, timeout, proxy):
     except requests.RequestException as e:
         return str(e), None
     else:
+        if r.status_code >= 400:
+            error = requests.status_codes._codes[r.status_code][0]
+            return '%d %s' % (r.status_code, error), None
         return None, r