Use HTTPS, fix v2 API, fix error logging#20
Merged
steffex merged 4 commits intosteffex:masterfrom Nov 5, 2020
Merged
Conversation
|
|
||
| def handleresponseerror(self, status): | ||
| if status == 401: | ||
| if status in {401, 403}: |
Collaborator
There was a problem hiding this comment.
Dictionary? Why not a list?
Contributor
Author
There was a problem hiding this comment.
No particular reason when it's so small, I just have a habit of using sets for lookups because they're fast.
I'll change it to a list to be less confusing.
Collaborator
There was a problem hiding this comment.
Oh it creates set. Was not aware of this syntax, but that's perfect.
- v2 returns a status code of 403 rather than 401. - The format string for v2 didn't work.
It could do the wrong thing in some implementations of Python.
urlopen raises a HTTPError upon failure, which didn't go through handleresponseerror(). The original handling is left in case there are obscure conditions where urlopen doesn't raise a HTTPError.
StefanRijnhart
approved these changes
Aug 24, 2020
gdalmau
approved these changes
Sep 10, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are small fixes for a few different issues. Mainly:
It's better to use HTTPS so people can't snoop on the API key and user addresses.
An earlier commit accidentally broke the formatting of the URL for the v2 API.
handleresponseerror()wasn't being used because it didn't expect anHTTPError.