diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 14:40:19 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-31 14:40:19 (GMT) |
commit | 1052f89a47a467918f4bc74010bd2e47be937f9a (patch) | |
tree | 10d95604c6b0057b9f6340583b5ae184f2f40100 /Doc/library/http.client.rst | |
parent | e2573160044a6373e8ffc14e840061e8518d1099 (diff) | |
download | cpython-1052f89a47a467918f4bc74010bd2e47be937f9a.zip cpython-1052f89a47a467918f4bc74010bd2e47be937f9a.tar.gz cpython-1052f89a47a467918f4bc74010bd2e47be937f9a.tar.bz2 |
Update HTTPResponse documentation and add placeholder for HTTPMessage.
Diffstat (limited to 'Doc/library/http.client.rst')
-rw-r--r-- | Doc/library/http.client.rst | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 5fcc0f0..4d9a4dd 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -59,8 +59,8 @@ The module provides the following classes: .. class:: HTTPResponse(sock[, debuglevel=0][, strict=0]) - Class whose instances are returned upon successful connection. Not instantiated - directly by user. + Class whose instances are returned upon successful connection. Not + instantiated directly by user. The following exceptions are raised as appropriate: @@ -433,7 +433,10 @@ also send your request step by step, by using the four functions below. HTTPResponse Objects -------------------- -:class:`HTTPResponse` instances have the following methods and attributes: +An :class:`HTTPResponse` instance wraps the HTTP response from the +server. It provides access to the request headers and the entity +body. The response is an iterable object and can be used in a with +statement. .. method:: HTTPResponse.read([amt]) @@ -454,7 +457,9 @@ HTTPResponse Objects .. attribute:: HTTPResponse.msg - An :class:`email.message.Message` instance containing the response headers. + A :class:`http.client.HTTPMessage` instance containing the response + headers. :class:`http.client.HTTPMessage` is a subclass of + :class:`email.message.Message`. .. attribute:: HTTPResponse.version @@ -472,6 +477,12 @@ HTTPResponse Objects Reason phrase returned by server. +.. attribute:: HTTPResponse.debuglevel + + A debugging hook. If `debuglevel` is greater than zero, messages + will be printed to stdout as the response is read and parsed. + + Examples -------- @@ -505,3 +516,14 @@ Here is an example session that shows how to ``POST`` requests:: >>> data = response.read() >>> conn.close() + +.. _httpmessage-objects: + +HTTPMessage Objects +------------------- + +An :class:`http.client.HTTPMessage` instance holds the headers from an +HTTP response. It is implemented using the +:class:`email.message.Message' class. + +XXX Define the methods that clients can depend upon between versions.
\ No newline at end of file |