From 3b82f75303d8750f56cd133c3aa0a022ca355709 Mon Sep 17 00:00:00 2001 From: itrujnara Date: Tue, 28 May 2024 16:10:37 +0200 Subject: [PATCH] Added retry for timeout --- bin/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/utils.py b/bin/utils.py index fc9a5a0..4662722 100644 --- a/bin/utils.py +++ b/bin/utils.py @@ -18,7 +18,7 @@ def safe_get(url: str): return requests.get(url, timeout = 300) except requests.exceptions.Timeout as e: print(f"Request timed out. This might be due to a server issue. If this persists, try again later. Details:\n{e}", file=sys.stderr) - sys.exit(9) + sys.exit(10) except requests.exceptions.RequestException as e: print(f"A network issue occurred. Retrying request. Details:\n{e}", file=sys.stderr) sys.exit(10) @@ -32,7 +32,7 @@ def safe_post(url: str, data: dict = dict(), json: dict = dict()): return requests.post(url, data = data, json = json, timeout = 300) except requests.exceptions.Timeout as e: print(f"Request timed out. This might be due to a server issue. If this persists, try again later. Details:\n{e}", file=sys.stderr) - sys.exit(9) + sys.exit(10) except requests.exceptions.RequestException as e: print(f"A network issue occurred. Retrying request. Details:\n{e}", file=sys.stderr) sys.exit(10)