From c114bac19923f5ea6fcf29a50c11adfa57fa026f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellert=20Sm=C3=A1ri=20Kristbergsson?= Date: Wed, 16 Feb 2022 11:50:09 +0000 Subject: [PATCH] Improved error handling on 502 --- intra.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/intra.py b/intra.py index 60b1a06..c3864dd 100644 --- a/intra.py +++ b/intra.py @@ -95,6 +95,10 @@ def request(self, method, url, headers={}, **kwargs): if rc < 500: raise ValueError(f"\n{res.headers}\n\nClientError. Error {str(rc)}\n{str(res.content)}\n{req_data}") else: + if rc == 502: + LOG.info("got a 502 error, this is a known issue with the server requesting again...") + time.sleep(0.5) + continue raise ValueError(f"\n{res.headers}\n\nServerError. Error {str(rc)}\n{str(res.content)}\n{req_data}") LOG.debug(f"Request to {url} returned with code {rc}")