Skip to content
Permalink
Browse files
fix: make 'requests.exceptions.ChunkedEncodingError retryable by defa…
…ult (#526)

Closes #525.
  • Loading branch information
tseaver committed Jul 27, 2021
1 parent aefe198 commit 4abb40310eca7ec45afc4bc5e4dfafbe083e74d2
Showing with 8 additions and 0 deletions.
  1. +2 −0 google/cloud/storage/retry.py
  2. +6 −0 tests/unit/test_retry.py
@@ -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
@@ -33,6 +34,7 @@
api_exceptions.ServiceUnavailable, # 503
api_exceptions.GatewayTimeout, # 504
requests.ConnectionError,
requests_exceptions.ChunkedEncodingError,
)


@@ -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))

0 comments on commit 4abb403

Please sign in to comment.