From: Oleg Broytman Date: Thu, 1 Aug 2024 07:26:13 +0000 (+0300) Subject: Fix(bkmk_rrequests): Check `r is not None` X-Git-Tag: 5.4.0~6 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=70458ec57cd4806f063a4dace265ce2abf3c28ce;p=bookmarks_db.git Fix(bkmk_rrequests): Check `r is not None` It seems `if r` is not enough -- `bool(r)` returns `False` in case there was an HTTP error. --- diff --git a/Robots/bkmk_rrequests.py b/Robots/bkmk_rrequests.py index e0e4d2d..e27c411 100644 --- a/Robots/bkmk_rrequests.py +++ b/Robots/bkmk_rrequests.py @@ -52,7 +52,9 @@ class robot_requests(robot_base): error = '%d %s' % (r.status_code, error) if error is not None: - return error, r.status_code if r else None, None, None, None + return error, \ + r.status_code if r is not None else None, \ + None, None, None if r.is_redirect: return None, r.status_code, r.next.url, None, None return None, None, None, r.headers, r.content