Patch #800236: add HTTPResponse.getheaders().

This commit is contained in:
Martin v. Löwis 2004-08-18 12:46:26 +00:00
parent c473c99d16
commit deacce2c87
3 changed files with 12 additions and 0 deletions

View File

@ -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}

View File

@ -493,6 +493,12 @@ class HTTPResponse:
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:

View File

@ -44,6 +44,8 @@ Extension modules
Library
-------
- HTTPResponse has now a getheaders method.
- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon
Percivall.