-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hey folks,
It seems like the client returns a ValueError regardless of the type of error when handling requests: here
This error will be raised if the response status code is anything other than 200. Therefore we have no way of telling what the error is and whether we should retry the request using the same parameters. It would be better if more descriptive errors were returned here.
Better yet, a built-in retry mechanism would be great; perhaps by updating the Adapter to use an optional retry strategy as shown below. I can submit a PR if that's helpful.
def __init__(self, tls_version=TlsVersions.TLSv1_2):
self._tls_version = tls_version
self.poolmanager = None
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
method_whitelist=["HEAD", "GET", "POST", "OPTIONS"]
)
super(EmailageClient.Adapter, self).__init__(max_retries=retry_strategy)
Metadata
Metadata
Assignees
Labels
No labels