-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
improve stability of ctx.add_basemap() #248
Conversation
…last error/reason message when max_retries is reached
I've merged #245, you can try updating this one |
The branch/fork was synced, but I think you have to approve the test workflow to be kicked off again. |
I believe that the remaining failures are not related. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a way of testing this easily so let's say this is fine as is, unless you want to tweak it further.
Ok, in that case please go ahead with merging the PR. Thanks for your consideration. I would like to update the minimal contextily version in my pyproject.toml once this fix is released. Is it already know when there will be a new release or not yet? |
I'll cut the patch release today. |
Fixes #247
Changed:
HTTPError
s are captured and retriedThe code in this contribution catches all
HTTPError
s and therefore makes it impossible that the code continue withNone
in thearrays
list. This used to cause varying errors related toNone
, depending on whether the first in thearrays
list wasNone
or not, or any of the others. By capturing all HTTPErrors, the code is redirected to retrying instead of that the_retryer()
function returns None. Aftermax_retries
is reached, the user now gets a informative error message. The format of the message is based on whatrequest.raise_for_status()
would return.The current code proves useful, these were the error messages during the manual tests:
HTTPError: Connection reset by peer too many times. Last message was: 502 Error: Bad Gateway for url: https://a.tile.openstreetmap.fr/hot/10/812/458.png
500 Error
(forgot to copy this one when it occurred@martinfleis could you review this PR?