diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-06-03 20:16:06 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-06-03 20:16:06 -0400 |
commit | 5822fc112a39f2620ffbb28c1341802bb6cb1536 (patch) | |
tree | 9a175bca4d544e86404180d8bcfee41297c3b8ba /Lib/urllib/request.py | |
parent | f032c4fdce0ac2e6702df056434a46c5a94d25de (diff) | |
download | cpython-5822fc112a39f2620ffbb28c1341802bb6cb1536.tar.gz |
Clean up urlopen doc string.
Clarifies what is returned when and that the methods are common between the two.
Patch by Alexander Liu as part of #22797.
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r-- | Lib/urllib/request.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 4a3daec5d0..333c3f245c 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -173,12 +173,7 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, The *cadefault* parameter is ignored. For http and https urls, this function returns a http.client.HTTPResponse - object which has the following HTTPResponse Objects methods. - - For ftp, file, and data urls and requests explicitly handled by legacy - URLopener and FancyURLopener classes, this function returns a - urllib.response.addinfourl object which can work as context manager and has - methods such as: + object which has the following HTTPResponse Objects methods: * geturl() - return the URL of the resource retrieved, commonly used to determine if a redirect was followed @@ -190,6 +185,11 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, * getcode() - return the HTTP status code of the response. Raises URLError on errors. + For ftp, file, and data urls and requests explicitly handled by legacy + URLopener and FancyURLopener classes, this function returns a + urllib.response.addinfourl object which can work as context manager and + also support the geturl(), info(), getcode() methods listed above. + Note that *None& may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens). |