From 70458ec57cd4806f063a4dace265ce2abf3c28ce Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 1 Aug 2024 10:26:13 +0300 Subject: [PATCH] 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. --- Robots/bkmk_rrequests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.39.5