Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Exceptions and Retry #30

Open
sahmadi-wave opened this issue Aug 19, 2020 · 0 comments
Open

Request Exceptions and Retry #30

sahmadi-wave opened this issue Aug 19, 2020 · 0 comments

Comments

@sahmadi-wave
Copy link

sahmadi-wave commented Aug 19, 2020

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)
@sahmadi-wave sahmadi-wave changed the title Request Exceptions Request Exceptions and Retry Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant