@@ -55,16 +55,8 @@ The :mod:`urllib.request` module defines the following functions:
5555 The *cadefault * parameter is ignored.
5656
5757 This function always returns an object which can work as a
58- :term: `context manager ` and has methods such as
59-
60- * :meth: `~urllib.response.addinfourl.geturl ` --- return the URL of the resource retrieved,
61- commonly used to determine if a redirect was followed
62-
63- * :meth: `~urllib.response.addinfourl.info ` --- return the meta-information of the page, such as headers,
64- in the form of an :func: `email.message_from_string ` instance (see
65- `Quick Reference to HTTP Headers <http://jkorpela.fi/http.html >`_)
66-
67- * :meth: `~urllib.response.addinfourl.getcode ` -- return the HTTP status code of the response.
58+ :term: `context manager ` and has the properties *url *, *headers *, and *status *.
59+ See :class: `urllib.response.addinfourl ` for more detail on these properties.
6860
6961 For HTTP and HTTPS URLs, this function returns a
7062 :class: `http.client.HTTPResponse ` object slightly modified. In addition
@@ -1585,9 +1577,42 @@ some point in the future.
15851577 :synopsis: Response classes used by urllib.
15861578
15871579The :mod: `urllib.response ` module defines functions and classes which define a
1588- minimal file like interface, including ``read() `` and ``readline() ``. The
1589- typical response object is an addinfourl instance, which defines an ``info() ``
1590- method and that returns headers and a ``geturl() `` method that returns the url.
1591- Functions defined by this module are used internally by the
1592- :mod: `urllib.request ` module.
1580+ minimal file-like interface, including ``read() `` and ``readline() ``.
1581+ Functions defined by this module are used internally by the :mod: `urllib.request ` module.
1582+ The typical response object is a :class: `urllib.response.addinfourl ` instance:
1583+
1584+ .. class :: addinfourl
1585+
1586+ .. attribute :: url
1587+
1588+ URL of the resource retrieved, commonly used to determine if a redirect was followed.
1589+
1590+ .. attribute :: headers
1591+
1592+ Returns the headers of the response in the form of an :class: `~email.message.EmailMessage ` instance.
1593+
1594+ .. attribute :: status
1595+
1596+ .. versionadded :: 3.9
1597+
1598+ Status code returned by server.
1599+
1600+ .. method :: geturl()
1601+
1602+ .. deprecated :: 3.9
1603+ Deprecated in favor of :attr: `~addinfourl.url `.
1604+
1605+ .. method :: info()
1606+
1607+ .. deprecated :: 3.9
1608+ Deprecated in favor of :attr: `~addinfourl.headers `.
1609+
1610+ .. attribute :: code
1611+
1612+ .. deprecated :: 3.9
1613+ Deprecated in favor of :attr: `~addinfourl.status `.
1614+
1615+ .. method :: getstatus()
15931616
1617+ .. deprecated :: 3.9
1618+ Deprecated in favor of :attr: `~addinfourl.status `.
0 commit comments