diff --git a/tap_xero/client.py b/tap_xero/client.py index 7e8ead3..5ec7bdd 100644 --- a/tap_xero/client.py +++ b/tap_xero/client.py @@ -12,6 +12,9 @@ import pytz import backoff import singer +from http.client import RemoteDisconnected +from requests.exceptions import ConnectionError,ReadTimeout,ChunkedEncodingError +from urllib3.exceptions import ProtocolError LOGGER = singer.get_logger() @@ -212,7 +215,7 @@ def refresh_credentials(self, config, config_path): self.tenant_id = config['tenant_id'] - @backoff.on_exception(backoff.expo, (json.decoder.JSONDecodeError, XeroInternalError), max_tries=3) + @backoff.on_exception(backoff.expo, (json.decoder.JSONDecodeError, XeroInternalError,RemoteDisconnected,ConnectionError,ReadTimeout,ChunkedEncodingError,ProtocolError), max_tries=3) @backoff.on_exception(retry_after_wait_gen, XeroTooManyInMinuteError, giveup=is_not_status_code_fn([429]), jitter=None, max_tries=3) def check_platform_access(self, config, config_path): @@ -234,7 +237,7 @@ def check_platform_access(self, config, config_path): raise_for_error(response) - @backoff.on_exception(backoff.expo, (json.decoder.JSONDecodeError, XeroInternalError), max_tries=3) + @backoff.on_exception(backoff.expo, (json.decoder.JSONDecodeError, XeroInternalError,RemoteDisconnected,ConnectionError,ReadTimeout,ChunkedEncodingError,ProtocolError), max_tries=3) @backoff.on_exception(retry_after_wait_gen, XeroTooManyInMinuteError, giveup=is_not_status_code_fn([429]), jitter=None, max_tries=3) def filter(self, tap_stream_id, since=None, **params): xero_resource_name = tap_stream_id.title().replace("_", "") diff --git a/tap_xero/streams.py b/tap_xero/streams.py index 7c3662b..0e12128 100644 --- a/tap_xero/streams.py +++ b/tap_xero/streams.py @@ -9,6 +9,9 @@ from dateutil.parser import parse from dateutil.relativedelta import relativedelta from tap_xero.client import XeroUnauthorizedError +from http.client import RemoteDisconnected +from requests.exceptions import ConnectionError,ReadTimeout,ChunkedEncodingError +from urllib3.exceptions import ProtocolError LOGGER = singer.get_logger() @@ -33,7 +36,7 @@ class RateLimitException(Exception): @backoff.on_exception(backoff.expo, - RateLimitException, + (RateLimitException,RemoteDisconnected,ConnectionError,ReadTimeout,ChunkedEncodingError,ProtocolError), max_tries=10, factor=2) def _make_request(ctx, tap_stream_id, filter_options=None, attempts=0):