diff --git a/antp/ankiconnect.py b/antp/ankiconnect.py index 2d21e9b..9c7278d 100644 --- a/antp/ankiconnect.py +++ b/antp/ankiconnect.py @@ -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: