@@ -59,13 +59,7 @@ The :mod:`urllib.request` module defines the following functions:
59
59
60
60
The *cadefault * parameter is ignored.
61
61
62
- For http and https urls, this function returns a
63
- :class: `http.client.HTTPResponse ` object which has the following
64
- :ref: `httpresponse-objects ` methods.
65
-
66
- For ftp, file, and data urls and requests explicitly handled by legacy
67
- :class: `URLopener ` and :class: `FancyURLopener ` classes, this function
68
- returns a :class: `urllib.response.addinfourl ` object which can work as
62
+ This function always returns an object which can work as
69
63
:term: `context manager ` and has methods such as
70
64
71
65
* :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:
77
71
78
72
* :meth: `~urllib.response.addinfourl.getcode ` -- return the HTTP status code of the response.
79
73
74
+ For http and https urls, this function returns a
75
+ :class: `http.client.HTTPResponse ` object slightly modified. In addition
76
+ to the three new methods above, the msg attribute contains the
77
+ same information as the :attr: `~http.client.HTTPResponse.reason `
78
+ attribute --- the reason phrase returned by server --- instead of
79
+ the response headers as it is specified in the documentation for
80
+ :class: `~http.client.HTTPResponse `.
81
+
82
+ For ftp, file, and data urls and requests explicitly handled by legacy
83
+ :class: `URLopener ` and :class: `FancyURLopener ` classes, this function
84
+ returns a :class: `urllib.response.addinfourl ` object.
85
+
80
86
Raises :exc: `~urllib.error.URLError ` on errors.
81
87
82
88
Note that ``None `` may be returned if no handler handles the request (though
0 commit comments