changeset: 99371:b55c006b79bc branch: 3.5 parent: 99368:38f749f0a1bd parent: 99370:fa3c9faabfb0 user: Martin Panter date: Thu Nov 26 11:03:50 2015 +0000 files: Doc/library/urllib.request.rst Misc/ACKS description: Issue #22989, #21228: Merge urlopen() doc from 3.4 into 3.5 diff -r 38f749f0a1bd -r b55c006b79bc Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst Thu Nov 26 02:36:26 2015 +0000 +++ b/Doc/library/urllib.request.rst Thu Nov 26 11:03:50 2015 +0000 @@ -59,13 +59,7 @@ 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 @@ * :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 diff -r 38f749f0a1bd -r b55c006b79bc Misc/ACKS --- a/Misc/ACKS Thu Nov 26 02:36:26 2015 +0000 +++ b/Misc/ACKS Thu Nov 26 11:03:50 2015 +0000 @@ -443,6 +443,7 @@ Michael Foord Amaury Forgeot d'Arc Doug Fort +Evens Fortuné Chris Foster John Fouhy Andrew Francis