Skip to content

Commit a8a1871

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.14] gh-89735: Document requirements for the *headers* argument (GH-155640) (GH-156899)
Both handlers look up the header name in lowercase, and the basic one needs get_all(), so a plain dict does not work. (cherry picked from commit 1414d2a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 958c1b6 commit a8a1871

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Doc/library/urllib.request.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,10 @@ AbstractBasicAuthHandler Objects
10601060
authenticate for, *req* should be the (failed) :class:`Request` object, and
10611061
*headers* should be the error headers.
10621062

1063+
*headers* must be a mapping-like object with case-insensitive lookup
1064+
that implements the ``get_all()`` method,
1065+
such as :class:`email.message.Message` or :class:`wsgiref.headers.Headers`.
1066+
10631067
*host* is either an authority (e.g. ``"python.org"``) or a URL containing an
10641068
authority component (e.g. ``"https://python.org/"``). In either case, the
10651069
authority must not contain a userinfo component (so, ``"python.org"`` and
@@ -1101,6 +1105,9 @@ AbstractDigestAuthHandler Objects
11011105
should be the (failed) :class:`Request` object, and *headers* should be the
11021106
error headers.
11031107

1108+
*headers* must be a mapping-like object with case-insensitive lookup,
1109+
such as :class:`email.message.Message` or :class:`wsgiref.headers.Headers`.
1110+
11041111

11051112
.. _http-digest-auth-handler:
11061113

0 commit comments

Comments
 (0)