Skip to content

Commit

Permalink
Handle timeout exception in async API
Browse files Browse the repository at this point in the history
  • Loading branch information
aaront committed Mar 16, 2021
1 parent 0c9dfa4 commit 27879f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mygeotab/py3/api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
Async/Await-able (Python 3.5+) public objects and methods wrapping the MyGeotab API.
"""

import asyncio
from copy import Error
import sys

if sys.version_info < (3, 5):
Expand Down Expand Up @@ -199,7 +201,7 @@ async def _query(server, method, parameters, timeout=DEFAULT_TIMEOUT, verify_ssl
response.raise_for_status()
content_type = response.headers.get("Content-Type")
body = await response.text()
except TimeoutError:
except (TimeoutError, asyncio.TimeoutError):
raise TimeoutException(server)
if content_type and "application/json" not in content_type.lower():
return body
Expand Down

0 comments on commit 27879f5

Please sign in to comment.