mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
Patch #800236: add HTTPResponse.getheaders().
This commit is contained in:
parent
c473c99d16
commit
deacce2c87
3 changed files with 12 additions and 0 deletions
|
|
@ -211,6 +211,10 @@ Get the contents of the header \var{name}, or \var{default} if there is no
|
|||
matching header.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{getheaders}{}
|
||||
Return a list of (header, value) tuples. \versionadded{2.4}
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{datadesc}{msg}
|
||||
A \class{mimetools.Message} instance containing the response headers.
|
||||
\end{datadesc}
|
||||
|
|
|
|||
|
|
@ -493,6 +493,12 @@ def getheader(self, name, default=None):
|
|||
raise ResponseNotReady()
|
||||
return self.msg.getheader(name, default)
|
||||
|
||||
def getheaders(self):
|
||||
"""Return list of (header, value) tuples."""
|
||||
if self.msg is None:
|
||||
raise ResponseNotReady()
|
||||
return self.msg.items()
|
||||
|
||||
|
||||
class HTTPConnection:
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ Extension modules
|
|||
Library
|
||||
-------
|
||||
|
||||
- HTTPResponse has now a getheaders method.
|
||||
|
||||
- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon
|
||||
Percivall.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue