-
Notifications
You must be signed in to change notification settings - Fork 342
Implementing HTTP retries for the SDK #247
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4ef3cf0
Implementing HTTP retries for the SDK
hiranya911 f3eacea
Adding test case for credential
hiranya911 9d474a4
Updated changelog
hiranya911 c0008da
Merged with master; Fixed a typo
hiranya911 2684015
Merge branch 'master' into hkj-http-retry
hiranya911 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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 am not finding
raise_on_status
as an argument to Retry object defined in version2.21.0
of requests module (most recent public version). Perhaps you are getting some other version? This is causing an error during import offirebase_admin.admin
on my setup.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.
retry.Retry
is a class defined inurllib3
. It has supportedraise_on_status
since v1.15 (released in 2016): urllib3/urllib3@9f48d26You need to upgrade urllib3 to something more recent.
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.
Your code reaches into a copy of
urllib3
that's bundled withrequests
. It's not possible to upgrade that independently, AFAIK. I am using the newestrequests
(2.21.0) and it contains this issue.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.
This has been developed and tested on latest
requests
. I double checked just now to make sure:requests
does not shipurllib3
with it (as far as I can tell). It just re-exports whatever it can find already installed in the system: https://github.com/requests/requests/blob/v2.21.0/requests/packages.pyThere 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.
requests
hasurllib3>=1.21.1,<1.25
as a requirement (in setup.py), and that range of versions will do what we want. However, my build process is using pip to construct zipfile modules (because appengine limitations) and when pip is finished withrequests
, the packages subdirectory inside has an obsolete version of urllib3 captured into the zip. I've since learned that is coming from the virtualenv being used for building, even though I've addedurllib3
to myrequirements.txt
, and pip finds and downloadsurllib3
1.24, but that is not what gets captured into the zipfile holdingrequests
!If your code used
from urllib3.util import retry
and specifiedurllib3
as a dependancy, then all would be well. Since we might hope thatrequests
will cleanup and remove thepackages
hack someday, maybe that would be a net improvement regardless?Thanks for your help today.
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.
That sounds like a reasonable change to make. Although I'm a little concerned about declaring a dependency on
urllib3
. We had to stop declaringrequests
as a dependency to work around a bug related to Firestore and pip. I wonder if addingurllib3
to our setup file will cause issues. But I can certainly experiment with that option and see if it's possible.