From d78996af5439068ee1749828097bfb26043f9be9 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Wed, 28 Aug 2019 13:58:36 +0200 Subject: [PATCH] bin/proxy.py: handle query timeouts --- bin/proxy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/proxy.py b/bin/proxy.py index 6d675c9..96d22a3 100644 --- a/bin/proxy.py +++ b/bin/proxy.py @@ -188,10 +188,14 @@ def proxy(path): url = '%s/%s?%s' % (srv, path, query_string) print(url) - attempts = 5 + attempts = 10 response = None while attempts: - response = requests.get(url, timeout=2) + try: + response = requests.get(url, timeout=2) + except requests.ReadTimeout: + attempts -= 1 + continue try: json.loads(response.content) break