add timeout
This commit is contained in:
parent
a71a2a389c
commit
aa51c91851
|
@ -16,7 +16,10 @@ def request(action, **params):
|
|||
|
||||
def invoke(action, **params):
|
||||
request_json = json.dumps(request(action, **params)).encode('utf-8')
|
||||
response = json.load(urllib.request.urlopen(urllib.request.Request('http://127.0.0.1:8765', request_json)))
|
||||
response = json.load(urllib.request.urlopen(
|
||||
urllib.request.Request('http://127.0.0.1:8765', request_json),
|
||||
timeout=10
|
||||
))
|
||||
if len(response) != 2:
|
||||
raise ANTPError('response has an unexpected number of fields')
|
||||
if 'error' not in response:
|
||||
|
|
Loading…
Reference in a new issue