bin/proxy.py: handle query timeouts
This commit is contained in:
parent
eecd88794c
commit
d78996af54
1 changed files with 6 additions and 2 deletions
|
|
@ -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…
Add table
Reference in a new issue