-
Notifications
You must be signed in to change notification settings - Fork 2
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
Set better headers for HTTP requests #178
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #178 +/- ##
==========================================
- Coverage 64.80% 64.63% -0.17%
==========================================
Files 1 1
Lines 1500 1513 +13
Branches 346 346
==========================================
+ Hits 972 978 +6
- Misses 431 438 +7
Partials 97 97
☔ View full report in Codecov by Sentry. |
@@ -2617,7 +2647,6 @@ def download_file( | |||
return | |||
except URLError as e: | |||
if isinstance(e, HTTPError) and e.code not in (500, 502, 503, 504): | |||
raise_for_ratelimit(e, headers.get("Authorization")) |
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.
so we are sacrificing limits reporting here? or it was not needed?
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.
Limit reporting is only for GitHub API requests, so I moved all the invocations of raise_for_ratelimit()
to inside GitHubClient
.
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.
ah, ok, this one is generic and not specific to github. notes: There is a use of download_file
within GithubClient at https://github.com/datalad/datalad-installer/blob/HEAD/src/datalad_installer.py#L2544 within download_release_asset
but it is likely the generic url so should not get affected by the API rate limit.
it is a last PR in a series ATM, I marked it to cut release. Thank you @jwodder ! |
User-Agent
for all requestsAccept
andX-GitHub-Api-Version
for GitHub requests to their recommended values