Skip to content

Commit

Permalink
retry on ChunkedEncodingError
Browse files Browse the repository at this point in the history
  • Loading branch information
“rdeshmukh15” committed Nov 6, 2024
1 parent 833565b commit 9377f24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tap_dixa/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import backoff
import requests

from requests.exceptions import ChunkedEncodingError
from tap_dixa.exceptions import (DixaClient429Error, DixaClient408Error,
DixaClient5xxError, raise_for_error,
retry_after_wait_gen)
Expand Down Expand Up @@ -61,7 +62,7 @@ def _post(self, url, headers=None, params=None, data=None):
return self._make_request(url, method="POST", headers=headers, params=params, data=data)

# Added retry logic for 3 times when bad request or server error or rate limit happens
@backoff.on_exception(retry_after_wait_gen, (DixaClient429Error, DixaClient5xxError,DixaClient408Error), jitter=None, max_tries=3)
@backoff.on_exception(retry_after_wait_gen, (DixaClient429Error, DixaClient5xxError,DixaClient408Error, ChunkedEncodingError), jitter=None, max_tries=5)
def _make_request(self, url, method, headers=None, params=None, data=None) -> dict:
"""
Makes the API request.
Expand Down

0 comments on commit 9377f24

Please sign in to comment.