This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clarify urllib.request.add_header documentation
Type: Stage: patch review
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, epicfaace, eric.araujo
Priority: normal Keywords: patch

Created on 2022-01-19 21:00 by epicfaace, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 30708 open epicfaace, 2022-01-19 21:05
Messages (3)
msg410983 - (view) Author: Ashwin Ramaswami (epicfaace) * Date: 2022-01-19 21:00
We should add a note that headers added via urllib.request.add_header are added to redirected requests. It isn't immediately clear upon reading the documentation that this is the case.
msg411173 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2022-01-21 19:22
I think the doc assumes that people will expect headers to be added for redirections, and if not the existence of the method `add_unredirected_header` that’s documented just after would tell it.

That said, the addition does no harm, so why not be explicit.
msg411174 - (view) Author: Ashwin Ramaswami (epicfaace) * Date: 2022-01-21 19:26
Yes -- additionally, since other http libraries (I believe) usually don't forward headers on redirections by default, the default for urllib.request is counterintuitive (and maybe even not ideal for security reasons?) and would benefit from additional clarification.
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90597
2022-01-21 19:26:45epicfaacesetmessages: + msg411174
2022-01-21 19:22:24eric.araujosetnosy: + eric.araujo
messages: + msg411173
2022-01-19 21:05:50epicfaacesetkeywords: + patch
stage: patch review
pull_requests: + pull_request28904
2022-01-19 21:00:26epicfaacecreate