Skip to content

Commit 1052f89

Browse files
committed
Update HTTPResponse documentation and add placeholder for HTTPMessage.
1 parent e257316 commit 1052f89

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

Doc/library/http.client.rst

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ The module provides the following classes:
5959

6060
.. class:: HTTPResponse(sock[, debuglevel=0][, strict=0])
6161

62-
Class whose instances are returned upon successful connection. Not instantiated
63-
directly by user.
62+
Class whose instances are returned upon successful connection. Not
63+
instantiated directly by user.
6464

6565

6666
The following exceptions are raised as appropriate:
@@ -433,7 +433,10 @@ also send your request step by step, by using the four functions below.
433433
HTTPResponse Objects
434434
--------------------
435435

436-
:class:`HTTPResponse` instances have the following methods and attributes:
436+
An :class:`HTTPResponse` instance wraps the HTTP response from the
437+
server. It provides access to the request headers and the entity
438+
body. The response is an iterable object and can be used in a with
439+
statement.
437440

438441

439442
.. method:: HTTPResponse.read([amt])
@@ -454,7 +457,9 @@ HTTPResponse Objects
454457

455458
.. attribute:: HTTPResponse.msg
456459

457-
An :class:`email.message.Message` instance containing the response headers.
460+
A :class:`http.client.HTTPMessage` instance containing the response
461+
headers. :class:`http.client.HTTPMessage` is a subclass of
462+
:class:`email.message.Message`.
458463

459464

460465
.. attribute:: HTTPResponse.version
@@ -472,6 +477,12 @@ HTTPResponse Objects
472477
Reason phrase returned by server.
473478

474479

480+
.. attribute:: HTTPResponse.debuglevel
481+
482+
A debugging hook. If `debuglevel` is greater than zero, messages
483+
will be printed to stdout as the response is read and parsed.
484+
485+
475486
Examples
476487
--------
477488

@@ -505,3 +516,14 @@ Here is an example session that shows how to ``POST`` requests::
505516
>>> data = response.read()
506517
>>> conn.close()
507518

519+
520+
.. _httpmessage-objects:
521+
522+
HTTPMessage Objects
523+
-------------------
524+
525+
An :class:`http.client.HTTPMessage` instance holds the headers from an
526+
HTTP response. It is implemented using the
527+
:class:`email.message.Message' class.
528+
529+
XXX Define the methods that clients can depend upon between versions.

0 commit comments

Comments
 (0)