Skip to content

Commit

Permalink
fix: make 'requests.exceptions.ChunkedEncodingError retryable by defa…
Browse files Browse the repository at this point in the history
…ult (#526)

Closes #525.
  • Loading branch information
tseaver committed Jul 27, 2021
1 parent aefe198 commit 4abb403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions google/cloud/storage/retry.py
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import requests
import requests.exceptions as requests_exceptions

from google.api_core import exceptions as api_exceptions
from google.api_core import retry
Expand All @@ -33,6 +34,7 @@
api_exceptions.ServiceUnavailable, # 503
api_exceptions.GatewayTimeout, # 504
requests.ConnectionError,
requests_exceptions.ChunkedEncodingError,
)


Expand Down
6 changes: 6 additions & 0 deletions tests/unit/test_retry.py
Expand Up @@ -69,6 +69,12 @@ def test_w_requests_connection_error(self):
exc = requests.ConnectionError()
self.assertTrue(self._call_fut(exc))

def test_w_requests_chunked_encoding_error(self):
import requests.exceptions

exc = requests.exceptions.ChunkedEncodingError()
self.assertTrue(self._call_fut(exc))

def test_miss_w_stdlib_error(self):
exc = ValueError("testing")
self.assertFalse(self._call_fut(exc))
Expand Down

0 comments on commit 4abb403

Please sign in to comment.