Skip to content

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

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

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

This branch has not been deployed

No deployments
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

1 participant