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

Add retry option based on Retry from urllib3.util #28

Merged
merged 5 commits into from
Oct 19, 2023

Conversation

romain894
Copy link
Contributor

Following this pull request, I reimplemented the retry with urllib3.util.Retry

This is based on this example from the requests documentation.

The retry option is disabled by default. However, the user can set the maximum number of retries, delay, and HTTP error codes to manage with the following parameters:

config.max_retries = 0
config.retry_backoff_factor = 0.1
config.retry_http_codes = [500, 503]

I added the errors 500 and 503 as they are the ones that we were experiencing and identified in the last pull request as coming from the OpenAlex API.

Copy link
Owner

@J535D165 J535D165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach a lot!

pyalex/api.py Outdated Show resolved Hide resolved
pyalex/api.py Show resolved Hide resolved
pyalex/api.py Outdated Show resolved Hide resolved
romain894 and others added 2 commits October 19, 2023 11:18
fixed allowed_methods to GET

Co-authored-by: Jonathan de Bruin <jonathandebruinos@gmail.com>
pyalex/api.py Outdated Show resolved Hide resolved
added error 429 support

Co-authored-by: Jonathan de Bruin <jonathandebruinos@gmail.com>
@J535D165 J535D165 self-requested a review October 19, 2023 11:46
Copy link
Owner

@J535D165 J535D165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

In the future, some documentation would be nice to have.

@J535D165 J535D165 changed the title Added a retry option based on Retry from urllib3.util Add retry option based on Retry from urllib3.util Oct 19, 2023
@J535D165 J535D165 merged commit 2fc6914 into J535D165:main Oct 19, 2023
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants