mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-12707: deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl (GH-11447)
Co-Authored-By: epicfaace <aramaswamis@gmail.com>
This commit is contained in:
parent
bb41147eab
commit
ff2e182865
7 changed files with 84 additions and 26 deletions
|
@ -163,18 +163,10 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
|
|||
|
||||
The *cadefault* parameter is ignored.
|
||||
|
||||
This function always returns an object which can work as a context
|
||||
manager and has methods such as
|
||||
|
||||
* geturl() - return the URL of the resource retrieved, commonly used to
|
||||
determine if a redirect was followed
|
||||
|
||||
* info() - return the meta-information of the page, such as headers, in the
|
||||
form of an email.message_from_string() instance (see Quick Reference to
|
||||
HTTP Headers)
|
||||
|
||||
* getcode() - return the HTTP status code of the response. Raises URLError
|
||||
on errors.
|
||||
This function always returns an object which can work as a
|
||||
context manager and has the properties url, headers, and status.
|
||||
See urllib.response.addinfourl for more detail on these properties.
|
||||
|
||||
For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse
|
||||
object slightly modified. In addition to the three new methods above, the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue