summaryrefslogtreecommitdiffstats
path: root/Doc/library/urllib.request.rst
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2013-02-07 08:47:01 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2013-02-07 08:47:01 (GMT)
commitb98e96a23f636b304c10d570bc1420a9ae213e08 (patch)
tree062d7707c2f313d06d20eda12087cf1eb4cba917 /Doc/library/urllib.request.rst
parent1acaf0bce2b1853a8457bc345630cd4b9b85e31b (diff)
downloadcpython-b98e96a23f636b304c10d570bc1420a9ae213e08.zip
cpython-b98e96a23f636b304c10d570bc1420a9ae213e08.tar.gz
cpython-b98e96a23f636b304c10d570bc1420a9ae213e08.tar.bz2
Fix Issue17069: Document getcode method in urllib.request.rst
Diffstat (limited to 'Doc/library/urllib.request.rst')
-rw-r--r--Doc/library/urllib.request.rst16
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index b4764cc..ff5dd62 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -57,16 +57,24 @@ The :mod:`urllib.request` module defines the following functions:
If neither *cafile* nor *capath* is specified, an HTTPS request
will not do any verification of the server's certificate.
- This function returns a file-like object that works as a :term:`context manager`,
- with two additional methods from the :mod:`urllib.response` module
+ For http and https urls, this function returns a
+ :class:`http.client.HTTPResponse` object which has the following
+ :ref:`httpresponse-objects` methods.
- * :meth:`geturl` --- return the URL of the resource retrieved,
+ For ftp, file, data urls and requests are explicity handled by legacy
+ :class:`URLopener` and :class:`FancyURLopener` class, this function returns
+ an :class:`urllib.response.addinfourl` 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,
commonly used to determine if a redirect was followed
- * :meth:`info` --- return the meta-information of the page, such as headers,
+ * :meth:`~urllib.response.addinfourl.info` --- return the meta-information of the page, such as headers,
in the form of an :func:`email.message_from_string` instance (see
`Quick Reference to HTTP Headers <http://www.cs.tut.fi/~jkorpela/http.html>`_)
+ * :meth:`~urllib.response.addinfourl.getcode` -- return the HTTP status code of the response.
+
Raises :exc:`URLError` on errors.
Note that ``None`` may be returned if no handler handles the request (though