bin/proxy.py: handle query timeouts

pull/339/head
Igor Chubin 5 years ago
parent eecd88794c
commit d78996af54

@ -188,10 +188,14 @@ def proxy(path):
url = '%s/%s?%s' % (srv, path, query_string) url = '%s/%s?%s' % (srv, path, query_string)
print(url) print(url)
attempts = 5 attempts = 10
response = None response = None
while attempts: while attempts:
response = requests.get(url, timeout=2) try:
response = requests.get(url, timeout=2)
except requests.ReadTimeout:
attempts -= 1
continue
try: try:
json.loads(response.content) json.loads(response.content)
break break

Loading…
Cancel
Save