From 2e1b0a31a146cd809797ebc3f7bcfa543e530f94 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 8 Aug 2024 20:52:48 +0300 Subject: [PATCH] Fix(bkmk_rrequests): Not all error codes have messages --- Robots/bkmk_rrequests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Robots/bkmk_rrequests.py b/Robots/bkmk_rrequests.py index 638ed91..ebe90cb 100644 --- a/Robots/bkmk_rrequests.py +++ b/Robots/bkmk_rrequests.py @@ -52,7 +52,10 @@ class robot_requests(robot_base): error = str(e) else: if r.status_code >= 400: - error = requests.status_codes._codes[r.status_code][0] + try: + error = requests.status_codes._codes[r.status_code][0] + except KeyError: + error = "Error" error = '%d %s' % (r.status_code, error) if error is not None: -- 2.39.5