Skip to content

Use default User-Agent and accept headers in save_large_file (#360) - #363

Closed
adityahabib wants to merge 1 commit into
openzim:mainfrom
adityahabib:fix-save-large-file-headers
Closed

adityahabib wants to merge 1 commit into
openzim:mainfrom
adityahabib:fix-save-large-file-headers

Conversation

@adityahabib

Copy link
Copy Markdown

Fix #360

save_large_file now accepts a headers argument and sends the
Wikimedia-compliant default User-Agent for upload.wikimedia.org when none
is given. An explicit User-Agent (from headers or user_agent) is kept.
This follows the approach #353 used for stream_file.

Changes:

  • download.py: new headers parameter, merged into the request headers
  • tests: 5 new tests (default UA, custom UA kept, extra headers merged,
    caller's dict not modified, other hosts untouched)
  • CHANGELOG entry

Tested locally: pytest tests/download/test_download.py, all passing.

Thank you

@benoit74

Copy link
Copy Markdown
Collaborator

@adityahabib I'm sorry but I will close this in favor of #362 ; I know you've been assigned the issue and @pawank925 should not have pushed a PR on something assigned to someone else but:

I'm a bit sorry about that, but I hope you will understand

@benoit74 benoit74 closed this Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b5ad688) to head (b986c95).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #363   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         2852      2859    +7     
  Branches       428       430    +2     
=========================================
+ Hits          2852      2859    +7     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

save_large_file should use default user-agent and accept arbitrary headers

2 participants