Skip to content

Commit 7a44aff

Browse files
Convert requests.Timeout exceptions to AsanaErrors
I noticed that we throw exceptions from the `requests` library without checking if they can be retried.
1 parent b90d0dd commit 7a44aff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

asana/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ def request(self, method, path, **options):
8181
self._add_version_header(request_options)
8282
while True:
8383
try:
84-
response = getattr(self.session, method)(
85-
url, auth=self.auth, **request_options)
84+
try:
85+
response = getattr(self.session, method)(
86+
url, auth=self.auth, **request_options)
87+
except requests.exceptions.Timeout:
88+
raise error.RetryableAsanaError()
89+
8690
self._log_asana_change_header(request_options['headers'], response.headers)
8791
if response.status_code in STATUS_MAP:
8892
raise STATUS_MAP[response.status_code](response)

0 commit comments

Comments
 (0)