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

Set better headers for HTTP requests #178

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Set better headers for HTTP requests #178

merged 1 commit into from
Nov 8, 2023

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Nov 8, 2023

  • Set User-Agent for all requests
  • Set Accept and X-GitHub-Api-Version for GitHub requests to their recommended values

@jwodder jwodder added the patch Increment the patch version when merged label Nov 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2023

Codecov Report

Attention: 24 lines in your changes are missing coverage. Please review.

Comparison is base (aab966e) 64.80% compared to head (b98703b) 64.63%.
Report is 2 commits behind head on master.

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              
Files Coverage Δ
src/datalad_installer.py 64.63% <33.33%> (-0.17%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -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"))
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@yarikoptic yarikoptic added the release Create a release when this pr is merged label Nov 8, 2023
@yarikoptic
Copy link
Member

it is a last PR in a series ATM, I marked it to cut release. Thank you @jwodder !

@yarikoptic yarikoptic merged commit 6106574 into master Nov 8, 2023
24 checks passed
@yarikoptic yarikoptic deleted the headers branch November 8, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants