From 5e540f28493cc3e13260458a8d1c6a1abb2ed313 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Fri, 23 Jul 2021 15:30:12 -0400 Subject: [PATCH] fix: add 'requests.exceptions.ChunkedEncodingError' to retryable exceptions (#237) Closes #235. --- google/api_core/retry.py | 1 + tests/unit/test_retry.py | 1 + 2 files changed, 2 insertions(+) diff --git a/google/api_core/retry.py b/google/api_core/retry.py index f0f23bc8..84967930 100644 --- a/google/api_core/retry.py +++ b/google/api_core/retry.py @@ -104,6 +104,7 @@ def if_exception_type_predicate(exception): exceptions.TooManyRequests, exceptions.ServiceUnavailable, requests.exceptions.ConnectionError, + requests.exceptions.ChunkedEncodingError, auth_exceptions.TransportError, ) """A predicate that checks if an exception is a transient API error. diff --git a/tests/unit/test_retry.py b/tests/unit/test_retry.py index f24c82be..199ca559 100644 --- a/tests/unit/test_retry.py +++ b/tests/unit/test_retry.py @@ -45,6 +45,7 @@ def test_if_transient_error(): assert retry.if_transient_error(exceptions.TooManyRequests("")) assert retry.if_transient_error(exceptions.ServiceUnavailable("")) assert retry.if_transient_error(requests.exceptions.ConnectionError("")) + assert retry.if_transient_error(requests.exceptions.ChunkedEncodingError("")) assert retry.if_transient_error(auth_exceptions.TransportError("")) assert not retry.if_transient_error(exceptions.InvalidArgument(""))