diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-11-26 11:03:50 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-26 11:03:50 (GMT) |
commit | 9e87f3d79fbf8d759d1b485296619d4f35cf1701 (patch) | |
tree | ffed5e82207a0f89f9f855af4a24e805140ecb38 /Doc | |
parent | 077e36af2517f609193db682250d072bb70c3fc4 (diff) | |
parent | 747d48cf27e1843f7d1046b4e8127833a40cf9b3 (diff) | |
download | cpython-9e87f3d79fbf8d759d1b485296619d4f35cf1701.zip cpython-9e87f3d79fbf8d759d1b485296619d4f35cf1701.tar.gz cpython-9e87f3d79fbf8d759d1b485296619d4f35cf1701.tar.bz2 |
Issue #22989, #21228: Merge urlopen() doc from 3.4 into 3.5
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/urllib.request.rst | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 3fe8278..6fde038 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -59,13 +59,7 @@ The :mod:`urllib.request` module defines the following functions: The *cadefault* parameter is ignored. - For http and https urls, this function returns a - :class:`http.client.HTTPResponse` object which has the following - :ref:`httpresponse-objects` methods. - - For ftp, file, and data urls and requests explicitly handled by legacy - :class:`URLopener` and :class:`FancyURLopener` classes, this function - returns a :class:`urllib.response.addinfourl` object which can work as + This function always returns an object which can work as :term:`context manager` and has methods such as * :meth:`~urllib.response.addinfourl.geturl` --- return the URL of the resource retrieved, @@ -77,6 +71,18 @@ The :mod:`urllib.request` module defines the following functions: * :meth:`~urllib.response.addinfourl.getcode` -- return the HTTP status code of the response. + For http and https urls, this function returns a + :class:`http.client.HTTPResponse` object slightly modified. In addition + to the three new methods above, the msg attribute contains the + same information as the :attr:`~http.client.HTTPResponse.reason` + attribute --- the reason phrase returned by server --- instead of + the response headers as it is specified in the documentation for + :class:`~http.client.HTTPResponse`. + + For ftp, file, and data urls and requests explicitly handled by legacy + :class:`URLopener` and :class:`FancyURLopener` classes, this function + returns a :class:`urllib.response.addinfourl` object. + Raises :exc:`~urllib.error.URLError` on errors. Note that ``None`` may be returned if no handler handles the request (though |