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

Fix handling of HTTP errors for replication handler #237

Merged
merged 5 commits into from
Nov 18, 2023

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Nov 18, 2023

When switching to the requests library, open_url ceased to throw an exception on HTTP errors because requests behaves differently than urllib. This adds an explicit raise_for_status() call to bring the exceptions back.

Also adds a retry handler from urllib3 to implicitly retry on transient HTTP errors. There is a fixed number of 3 retries and the list of status codes that are considered transient is the same as the one curl uses.

Switch the tests for replication to run against a local HTTP test server, so that the test cover the behaviour of request as well.

Fixes #235.

Requests does not throw on HTTP errors, so pyosmium was just consuming
the error message. Fix that. Also add a retry mechanism for
transient errors. The list of transient status codes is the
same as the one that curl uses.
@lonvia lonvia merged commit f9ca6c7 into osmcode:master Nov 18, 2023
19 checks passed
@lonvia lonvia deleted the retry-on-500-errors branch November 18, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Odd error with minutely diffs when server returns 500
1 participant