From 18a7eac930aa744065ea08cf59db909eafad886c Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 10:44:34 -0800 Subject: [PATCH 01/28] bpo-12707: deprecate info(), geturl(), getcode() from HTTPResponse and addinfo --- Lib/http/client.py | 16 ++++++++++++++++ Lib/test/test_urllib.py | 3 +++ Lib/test/test_urllib_response.py | 4 ++++ Lib/urllib/response.py | 13 ++++++++++++- 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Lib/http/client.py b/Lib/http/client.py index 5aa178d7b127d9..95643f696cdc1a 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -755,6 +755,10 @@ def info(self): description of the mimetools module. ''' + import warnings + warnings.warn("HTTPResponse.info() is deprecated" + "use HTTPResponse.headers instead", + DeprecationWarning, stacklevel=2) return self.headers def geturl(self): @@ -767,6 +771,10 @@ def geturl(self): redirected URL. ''' + import warnings + warnings.warn("HTTPResponse.geturl() is deprecated" + "use HTTPResponse.url instead", + DeprecationWarning, stacklevel=2) return self.url def getcode(self): @@ -774,6 +782,14 @@ def getcode(self): or None if the URL is not an HTTP URL. ''' + import warnings + warnings.warn("HTTPResponse.getcode() is deprecated" + "use HTTPResponse.code instead", + DeprecationWarning, stacklevel=2) + return self.status + + @property + def code(self): return self.status class HTTPConnection: diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index c292d74f84a93c..ff75ab5ad0d80a 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -187,12 +187,15 @@ def test_close(self): def test_info(self): self.assertIsInstance(self.returned_obj.info(), email.message.Message) + self.assertIsInstance(self.returned_obj.info, email.message.Message) def test_geturl(self): self.assertEqual(self.returned_obj.geturl(), self.pathname) + self.assertEqual(self.returned_obj.url, self.pathname) def test_getcode(self): self.assertIsNone(self.returned_obj.getcode()) + self.assertIsNone(self.returned_obj.code) def test_iter(self): # Test iterator diff --git a/Lib/test/test_urllib_response.py b/Lib/test/test_urllib_response.py index 0eb59426ccb630..d05c72cad82da3 100644 --- a/Lib/test/test_urllib_response.py +++ b/Lib/test/test_urllib_response.py @@ -42,6 +42,7 @@ def closehook(): def test_addinfo(self): info = urllib.response.addinfo(self.fp, self.test_headers) self.assertEqual(info.info(), self.test_headers) + self.assertEqual(info.info, self.test_headers) def test_addinfourl(self): url = "http://www.python.org" @@ -51,6 +52,9 @@ def test_addinfourl(self): self.assertEqual(infourl.info(), self.test_headers) self.assertEqual(infourl.geturl(), url) self.assertEqual(infourl.getcode(), code) + self.assertEqual(infourl.info, self.test_headers) + self.assertEqual(infourl.url, url) + self.assertEqual(infourl.code, code) def tearDown(self): self.sock.close() diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py index 4778118dbb1768..8ab7ad882f56e0 100644 --- a/Lib/urllib/response.py +++ b/Lib/urllib/response.py @@ -62,9 +62,12 @@ def __init__(self, fp, headers): self.headers = headers def info(self): + import warnings + warnings.warn("addinfo.info() is deprecated" + "use addinfo.headers instead", + DeprecationWarning, stacklevel=2) return self.headers - class addinfourl(addinfo): """class to add info() and geturl() methods to an open file.""" @@ -74,7 +77,15 @@ def __init__(self, fp, headers, url, code=None): self.code = code def getcode(self): + import warnings + warnings.warn("addinfourl.getcode() is deprecated" + "use addinfourl.code instead", + DeprecationWarning, stacklevel=2) return self.code def geturl(self): + import warnings + warnings.warn("addinfourl.geturl() is deprecated" + "use addinfourl.url instead", + DeprecationWarning, stacklevel=2) return self.url From 2e93da40ddd89f260f4d6c68807f302458d6684b Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 11:09:14 -0800 Subject: [PATCH 02/28] bpo-12707: rename 'code' attribute to 'status' --- Lib/http/client.py | 6 +----- Lib/test/test_urllib.py | 2 +- Lib/urllib/response.py | 6 +++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/http/client.py b/Lib/http/client.py index 95643f696cdc1a..8b974cdb2c6e4a 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -784,13 +784,9 @@ def getcode(self): ''' import warnings warnings.warn("HTTPResponse.getcode() is deprecated" - "use HTTPResponse.code instead", + "use HTTPResponse.status instead", DeprecationWarning, stacklevel=2) return self.status - - @property - def code(self): - return self.status class HTTPConnection: diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index ff75ab5ad0d80a..15dec8fdde8ec5 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -195,7 +195,7 @@ def test_geturl(self): def test_getcode(self): self.assertIsNone(self.returned_obj.getcode()) - self.assertIsNone(self.returned_obj.code) + self.assertIsNone(self.returned_obj.status) def test_iter(self): # Test iterator diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py index 8ab7ad882f56e0..2512f4a0b36b76 100644 --- a/Lib/urllib/response.py +++ b/Lib/urllib/response.py @@ -76,10 +76,14 @@ def __init__(self, fp, headers, url, code=None): self.url = url self.code = code + @property + def status(self): + return self.code + def getcode(self): import warnings warnings.warn("addinfourl.getcode() is deprecated" - "use addinfourl.code instead", + "use addinfourl.status instead", DeprecationWarning, stacklevel=2) return self.code From 2db7e1f18462828ad3519bb88d15c725b9bdc11a Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 11:36:07 -0800 Subject: [PATCH 03/28] bpo-12707: Document properties and deprecation of methods --- Doc/library/http.client.rst | 26 +++++++++++++++ Doc/library/urllib.request.rst | 59 +++++++++++++++++++++++++--------- Lib/urllib/request.py | 14 ++------ 3 files changed, 73 insertions(+), 26 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 3408c103e2f328..664a2cd9539a30 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -460,6 +460,14 @@ statement. HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1. +.. attribute:: HTTPResponse.url + + URL of the resource retrieved, commonly used to determine if a redirect was followed + +.. attribute:: HTTPResponse.headers + + Headers of the response in the form of an :meth:`email.message_from_string` instance + .. attribute:: HTTPResponse.status Status code returned by server. @@ -477,6 +485,24 @@ statement. Is ``True`` if the stream is closed. +.. method:: HTTPResponse.geturl() + + .. deprecated:: 3.8 + + Returns the URL of the resource retrieved. Deprecated in favor of *HTTPResponse.url*. + +.. method:: HTTPResponse.info() + + .. deprecated:: 3.8 + + Returns the response headers. Deprecated in favor of *HTTPResponse.headers*. + +.. method:: HTTPResponse.getstatus() + + .. deprecated:: 3.8 + + Returns the status. Deprecated in favor of *HTTPResponse.status*. + Examples -------- diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 982f57f1fe61a5..a6fb1571e652ab 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -55,16 +55,8 @@ The :mod:`urllib.request` module defines the following functions: The *cadefault* parameter is ignored. This function always returns an object which can work as a - :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:`~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 `_) - - * :meth:`~urllib.response.addinfourl.getcode` -- return the HTTP status code of the response. + :term:`context manager` and has the properties `url`, `headers`, and `status`. + See :class:`urllib.response.addinfourl` for more detail on these properties. For HTTP and HTTPS URLs, this function returns a :class:`http.client.HTTPResponse` object slightly modified. In addition @@ -1557,9 +1549,46 @@ some point in the future. :synopsis: Response classes used by urllib. The :mod:`urllib.response` module defines functions and classes which define a -minimal file like interface, including ``read()`` and ``readline()``. The -typical response object is an addinfourl instance, which defines an ``info()`` -method and that returns headers and a ``geturl()`` method that returns the url. -Functions defined by this module are used internally by the -:mod:`urllib.request` module. +minimal file-like interface, including ``read()`` and ``readline()``. +Functions defined by this module are used internally by the :mod:`urllib.request` module. +The typical response object is a :class:`urllib.response.addinfourl` instance: + +.. class:: urllib.response.addinfourl + +.. attribute:: addinfourl.url + + URL of the resource retrieved, commonly used to determine if a redirect was followed + +.. attribute:: addinfourl.headers + + Returns 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 `_) + +.. attribute:: addinfourl.code + + Status code returned by server. + +.. attribute:: addinfourl.status + + .. deprecated:: 3.8 + + Status code returned by server. Deprecated in favor of *addinfourl.status*. + +.. method:: addinfourl.geturl() + + .. deprecated:: 3.8 + + Returns the URL of the resource retrieved. Deprecated in favor of *addinfourl.url*. + +.. method:: addinfourl.info() + + .. deprecated:: 3.8 + + Returns the response headers. Deprecated in favor of *addinfourl.headers*. + +.. method:: addinfourl.getstatus() + + .. deprecated:: 3.8 + Returns the status. Deprecated in favor of *addinfourl.status*. \ No newline at end of file diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 9a3d399f018931..cda2b7f5b8683e 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -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 + :term:`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 From beadb348531f197fa9faa3cb151ea65465034a74 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 14:09:20 -0800 Subject: [PATCH 04/28] bpo-21257: remove deprecation warnings --- Lib/http/client.py | 12 ------------ Lib/urllib/response.py | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/Lib/http/client.py b/Lib/http/client.py index 8b974cdb2c6e4a..5aa178d7b127d9 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -755,10 +755,6 @@ def info(self): description of the mimetools module. ''' - import warnings - warnings.warn("HTTPResponse.info() is deprecated" - "use HTTPResponse.headers instead", - DeprecationWarning, stacklevel=2) return self.headers def geturl(self): @@ -771,10 +767,6 @@ def geturl(self): redirected URL. ''' - import warnings - warnings.warn("HTTPResponse.geturl() is deprecated" - "use HTTPResponse.url instead", - DeprecationWarning, stacklevel=2) return self.url def getcode(self): @@ -782,10 +774,6 @@ def getcode(self): or None if the URL is not an HTTP URL. ''' - import warnings - warnings.warn("HTTPResponse.getcode() is deprecated" - "use HTTPResponse.status instead", - DeprecationWarning, stacklevel=2) return self.status class HTTPConnection: diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py index 2512f4a0b36b76..8a27370b52e215 100644 --- a/Lib/urllib/response.py +++ b/Lib/urllib/response.py @@ -62,10 +62,6 @@ def __init__(self, fp, headers): self.headers = headers def info(self): - import warnings - warnings.warn("addinfo.info() is deprecated" - "use addinfo.headers instead", - DeprecationWarning, stacklevel=2) return self.headers class addinfourl(addinfo): @@ -81,15 +77,7 @@ def status(self): return self.code def getcode(self): - import warnings - warnings.warn("addinfourl.getcode() is deprecated" - "use addinfourl.status instead", - DeprecationWarning, stacklevel=2) return self.code def geturl(self): - import warnings - warnings.warn("addinfourl.geturl() is deprecated" - "use addinfourl.url instead", - DeprecationWarning, stacklevel=2) return self.url From 2a16f9b5c59f399ade4a8fc9ff88590a25e34bb7 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 14:27:15 -0800 Subject: [PATCH 05/28] bpo-21257: fix whitespace --- Lib/urllib/response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py index 8a27370b52e215..0adab88f19ac58 100644 --- a/Lib/urllib/response.py +++ b/Lib/urllib/response.py @@ -75,7 +75,7 @@ def __init__(self, fp, headers, url, code=None): @property def status(self): return self.code - + def getcode(self): return self.code From f07f4562f0817e8d97905aa71c679bfd3eb330ed Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 14:29:35 -0800 Subject: [PATCH 06/28] bpo-12707: remove deprecation warnings from doc --- Doc/library/http.client.rst | 12 +++--------- Doc/library/urllib.request.rst | 16 ++++------------ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 664a2cd9539a30..7dce44b913a9ac 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -487,21 +487,15 @@ statement. .. method:: HTTPResponse.geturl() - .. deprecated:: 3.8 - - Returns the URL of the resource retrieved. Deprecated in favor of *HTTPResponse.url*. + Returns the URL of the resource retrieved. Recommended to use *HTTPResponse.url* instead. .. method:: HTTPResponse.info() - .. deprecated:: 3.8 - - Returns the response headers. Deprecated in favor of *HTTPResponse.headers*. + Returns the response headers. Recommended to use *HTTPResponse.headers* instead. .. method:: HTTPResponse.getstatus() - .. deprecated:: 3.8 - - Returns the status. Deprecated in favor of *HTTPResponse.status*. + Returns the status. Recommended to use *HTTPResponse.status* instead. Examples -------- diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index a6fb1571e652ab..a429700ab74eba 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,24 +1571,16 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.status - .. deprecated:: 3.8 - - Status code returned by server. Deprecated in favor of *addinfourl.status*. + Status code returned by server. Recommended to use *addinfourl.status* instead. .. method:: addinfourl.geturl() - .. deprecated:: 3.8 - - Returns the URL of the resource retrieved. Deprecated in favor of *addinfourl.url*. + Returns the URL of the resource retrieved. Recommended to use *addinfourl.url* instead. .. method:: addinfourl.info() - .. deprecated:: 3.8 - - Returns the response headers. Deprecated in favor of *addinfourl.headers*. + Returns the response headers. Recommended to use *addinfourl.headers* instead. .. method:: addinfourl.getstatus() - .. deprecated:: 3.8 - - Returns the status. Deprecated in favor of *addinfourl.status*. \ No newline at end of file + Returns the status. Deprecated in favor of *addinfourl.status* instead. \ No newline at end of file From 5640148807f3202e853e0f92fb32925124dfa73b Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 14:30:38 -0800 Subject: [PATCH 07/28] bpo-12707: remove deprecation warning for addurlinfo.getstatus() in docs --- Doc/library/urllib.request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index a429700ab74eba..277b0832c11d6c 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1583,4 +1583,4 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. method:: addinfourl.getstatus() - Returns the status. Deprecated in favor of *addinfourl.status* instead. \ No newline at end of file + Returns the status. Recommended to use *addinfourl.status* instead. \ No newline at end of file From 51cd8ad412bdda21705e37c89c88a8794b73d131 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 17:17:09 -0800 Subject: [PATCH 08/28] bpo-12707: rename code to status in test --- Lib/test/test_urllib_response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_urllib_response.py b/Lib/test/test_urllib_response.py index d05c72cad82da3..76bf9f4c0158b8 100644 --- a/Lib/test/test_urllib_response.py +++ b/Lib/test/test_urllib_response.py @@ -54,7 +54,7 @@ def test_addinfourl(self): self.assertEqual(infourl.getcode(), code) self.assertEqual(infourl.info, self.test_headers) self.assertEqual(infourl.url, url) - self.assertEqual(infourl.code, code) + self.assertEqual(infourl.status, code) def tearDown(self): self.sock.close() From c199098b2ce2a6d865ffd7f2f3d801364a4b6342 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Sun, 6 Jan 2019 17:34:26 -0800 Subject: [PATCH 09/28] bpo-12707: rename info to headers in tests --- Lib/test/test_urllib.py | 2 +- Lib/test/test_urllib_response.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 15dec8fdde8ec5..7350795e1e1a28 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -187,7 +187,7 @@ def test_close(self): def test_info(self): self.assertIsInstance(self.returned_obj.info(), email.message.Message) - self.assertIsInstance(self.returned_obj.info, email.message.Message) + self.assertIsInstance(self.returned_obj.headers, email.message.Message) def test_geturl(self): self.assertEqual(self.returned_obj.geturl(), self.pathname) diff --git a/Lib/test/test_urllib_response.py b/Lib/test/test_urllib_response.py index 76bf9f4c0158b8..73d2ef0424f4af 100644 --- a/Lib/test/test_urllib_response.py +++ b/Lib/test/test_urllib_response.py @@ -42,7 +42,7 @@ def closehook(): def test_addinfo(self): info = urllib.response.addinfo(self.fp, self.test_headers) self.assertEqual(info.info(), self.test_headers) - self.assertEqual(info.info, self.test_headers) + self.assertEqual(info.headers, self.test_headers) def test_addinfourl(self): url = "http://www.python.org" @@ -52,7 +52,7 @@ def test_addinfourl(self): self.assertEqual(infourl.info(), self.test_headers) self.assertEqual(infourl.geturl(), url) self.assertEqual(infourl.getcode(), code) - self.assertEqual(infourl.info, self.test_headers) + self.assertEqual(infourl.headers, self.test_headers) self.assertEqual(infourl.url, url) self.assertEqual(infourl.status, code) From 58ced252bed180230c6ce28bea57500473e66d09 Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Mon, 7 Jan 2019 08:28:16 -0800 Subject: [PATCH 10/28] Apply suggestions from code review Co-Authored-By: epicfaace --- Doc/library/http.client.rst | 4 ++-- Doc/library/urllib.request.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 7dce44b913a9ac..caa6d84f5e4895 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -462,11 +462,11 @@ statement. .. attribute:: HTTPResponse.url - URL of the resource retrieved, commonly used to determine if a redirect was followed + URL of the resource retrieved, commonly used to determine if a redirect was followed. .. attribute:: HTTPResponse.headers - Headers of the response in the form of an :meth:`email.message_from_string` instance + Headers of the response in the form of an :meth:`email.message_from_string` instance. .. attribute:: HTTPResponse.status diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 277b0832c11d6c..0d3f407e05b162 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1557,7 +1557,7 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.url - URL of the resource retrieved, commonly used to determine if a redirect was followed + URL of the resource retrieved, commonly used to determine if a redirect was followed. .. attribute:: addinfourl.headers @@ -1583,4 +1583,4 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. method:: addinfourl.getstatus() - Returns the status. Recommended to use *addinfourl.status* instead. \ No newline at end of file + Returns the status. Recommended to use *addinfourl.status* instead. From 13d373f3ee4350b83e462b8b21b3968580b072a2 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 7 Jan 2019 08:33:30 -0800 Subject: [PATCH 11/28] bpo-12707: Add links to doc --- Doc/library/http.client.rst | 6 +++--- Doc/library/urllib.request.rst | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 7dce44b913a9ac..39e16d3fa9180a 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -487,15 +487,15 @@ statement. .. method:: HTTPResponse.geturl() - Returns the URL of the resource retrieved. Recommended to use *HTTPResponse.url* instead. + Returns the URL of the resource retrieved. Recommended to use :attr:`~HTTPResponse.url` instead. .. method:: HTTPResponse.info() - Returns the response headers. Recommended to use *HTTPResponse.headers* instead. + Returns the response headers. Recommended to use :attr:`~HTTPResponse.headers` instead. .. method:: HTTPResponse.getstatus() - Returns the status. Recommended to use *HTTPResponse.status* instead. + Returns the status. Recommended to use :attr:`~HTTPResponse.status` instead. Examples -------- diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 277b0832c11d6c..702f4fff97fcce 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,16 +1571,16 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.status - Status code returned by server. Recommended to use *addinfourl.status* instead. + Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. .. method:: addinfourl.geturl() - Returns the URL of the resource retrieved. Recommended to use *addinfourl.url* instead. + Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.status` instead. .. method:: addinfourl.info() - Returns the response headers. Recommended to use *addinfourl.headers* instead. + Returns the response headers. Recommended to use :attr:`~addinfourl.status` instead. .. method:: addinfourl.getstatus() - Returns the status. Recommended to use *addinfourl.status* instead. \ No newline at end of file + Returns the status. Recommended to use :attr:`~addinfourl.status` instead. \ No newline at end of file From b99fb9fe94099f3dd571e13fe393e041822f5c02 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 7 Jan 2019 08:38:29 -0800 Subject: [PATCH 12/28] bpo-12707: remove empty line --- Lib/urllib/response.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/urllib/response.py b/Lib/urllib/response.py index 0adab88f19ac58..5a2c3cc78c395d 100644 --- a/Lib/urllib/response.py +++ b/Lib/urllib/response.py @@ -64,6 +64,7 @@ def __init__(self, fp, headers): def info(self): return self.headers + class addinfourl(addinfo): """class to add info() and geturl() methods to an open file.""" From 1cf719c913196f36a848cb1994fb2b6db8ebb3f4 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 8 Jan 2019 19:12:22 -0800 Subject: [PATCH 13/28] bpo-12707: fix typos --- Doc/library/urllib.request.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index c5152637593da8..b13e220df6151a 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,15 +1571,15 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.status - Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. + Status code returned by server. .. method:: addinfourl.geturl() - Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.status` instead. + Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.url` instead. .. method:: addinfourl.info() - Returns the response headers. Recommended to use :attr:`~addinfourl.status` instead. + Returns the response headers. Recommended to use :attr:`~addinfourl.headers` instead. .. method:: addinfourl.getstatus() From 2c3a63f343128fea61735ffa63ccf25b2f3b3de0 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 8 Jan 2019 19:13:31 -0800 Subject: [PATCH 14/28] bpo-12707: add versionadded directive --- Doc/library/urllib.request.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index b13e220df6151a..fac7aef20898f2 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,6 +1571,8 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.status + .. versionadded:: 3.8 + Status code returned by server. .. method:: addinfourl.geturl() From c57eb8cb1d6db9277040f0ee8edaf159d99acf2d Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 8 Jan 2019 19:14:16 -0800 Subject: [PATCH 15/28] bpo-12707: recommendation to use addinfourl.status instead of .code --- Doc/library/urllib.request.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index fac7aef20898f2..bcfb9082643b71 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1565,10 +1565,6 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: in the form of an :func:`email.message_from_string` instance (see `Quick Reference to HTTP Headers `_) -.. attribute:: addinfourl.code - - Status code returned by server. - .. attribute:: addinfourl.status .. versionadded:: 3.8 @@ -1583,6 +1579,10 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: Returns the response headers. Recommended to use :attr:`~addinfourl.headers` instead. +.. attribute:: addinfourl.code + + Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. + .. method:: addinfourl.getstatus() Returns the status. Recommended to use :attr:`~addinfourl.status` instead. From 2174ea5fa21b16af2ee699c41cee5e50b8bcb2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 8 Jan 2019 19:16:26 -0800 Subject: [PATCH 16/28] Update Doc/library/urllib.request.rst Co-Authored-By: epicfaace --- Doc/library/urllib.request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index c5152637593da8..6603a5d3b8110b 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -55,7 +55,7 @@ The :mod:`urllib.request` module defines the following functions: The *cadefault* parameter is ignored. This function always returns an object which can work as a - :term:`context manager` and has the properties `url`, `headers`, and `status`. + :term:`context manager` and has the properties *url*, *headers*, and *status*. See :class:`urllib.response.addinfourl` for more detail on these properties. For HTTP and HTTPS URLs, this function returns a From 47f1656a4a16c8940bbb7348aafe3a3434b625fd Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 8 Jan 2019 19:17:46 -0800 Subject: [PATCH 17/28] bpo-12707: use email.message.EmailMessage --- Doc/library/urllib.request.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index bcfb9082643b71..746dafe8abb142 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1562,8 +1562,7 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.headers Returns 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 `_) + in the form of an :class:`~email.message.EmailMessage` instance. .. attribute:: addinfourl.status From 10d4720f709ec4df165bd42ad28176d57c17d4f0 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 8 Jan 2019 19:20:10 -0800 Subject: [PATCH 18/28] bpo-12707: clean up wording for headers --- Doc/library/http.client.rst | 2 +- Doc/library/urllib.request.rst | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index cb2e222fd5d625..a6dfd874a3313b 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -466,7 +466,7 @@ statement. .. attribute:: HTTPResponse.headers - Headers of the response in the form of an :meth:`email.message_from_string` instance. + Headers of the response in the form of an :class:`email.message.EmailMessage` instance. .. attribute:: HTTPResponse.status diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 746dafe8abb142..90ce606e28be36 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1561,13 +1561,12 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: addinfourl.headers - Returns the meta-information of the page, such as headers, - in the form of an :class:`~email.message.EmailMessage` instance. + Returns the headers of the response in the form of an :class:`~email.message.EmailMessage` instance. .. attribute:: addinfourl.status .. versionadded:: 3.8 - + Status code returned by server. .. method:: addinfourl.geturl() From c0e78bc70a951f61c52820bdc279587b6b36226c Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Fri, 11 Jan 2019 15:52:17 -0800 Subject: [PATCH 19/28] bpo-12707: re-add deprecation wording in doc --- Doc/library/http.client.rst | 6 +++--- Doc/library/urllib.request.rst | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index a6dfd874a3313b..eac73fd73eeacb 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -487,15 +487,15 @@ statement. .. method:: HTTPResponse.geturl() - Returns the URL of the resource retrieved. Recommended to use :attr:`~HTTPResponse.url` instead. + Deprecated method equivalent to :attr:`HTTPResponse.url`. .. method:: HTTPResponse.info() - Returns the response headers. Recommended to use :attr:`~HTTPResponse.headers` instead. + Deprecated method equivalent to :attr:`HTTPResponse.headers`. .. method:: HTTPResponse.getstatus() - Returns the status. Recommended to use :attr:`~HTTPResponse.status` instead. + Deprecated method equivalent to :attr:`~HTTPResponse.status`. Examples -------- diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 6eac2cb4f62acb..e87b2f596c059d 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,16 +1571,16 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. method:: addinfourl.geturl() - Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.url` instead. + Deprecated method equivalent to :attr:`~addinfourl.url`. .. method:: addinfourl.info() - Returns the response headers. Recommended to use :attr:`~addinfourl.headers` instead. + Deprecated method equivalent to :attr:`~addinfourl.headers`. .. attribute:: addinfourl.code - Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. + Deprecated attribute equivalent to :attr:`~addinfourl.status`. .. method:: addinfourl.getstatus() - Returns the status. Recommended to use :attr:`~addinfourl.status` instead. + Deprecated method equivalent to :attr:`~addinfourl.status`. From febc20635d3cc6b16b9e184f4bb3245de1a619a2 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Fri, 11 Jan 2019 15:54:40 -0800 Subject: [PATCH 20/28] bpo-12707: Separate tests for new and old attributes --- Lib/test/test_urllib.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 7350795e1e1a28..6923008318de3e 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -185,17 +185,23 @@ def test_close(self): # by the tearDown() method for the test self.returned_obj.close() + def test_headers(self): + self.assertIsInstance(self.returned_obj.headers, email.message.Message) + + def test_url(self): + self.assertEqual(self.returned_obj.url, self.pathname) + + def test_status(self): + self.assertIsNone(self.returned_obj.status) + def test_info(self): self.assertIsInstance(self.returned_obj.info(), email.message.Message) - self.assertIsInstance(self.returned_obj.headers, email.message.Message) def test_geturl(self): self.assertEqual(self.returned_obj.geturl(), self.pathname) - self.assertEqual(self.returned_obj.url, self.pathname) def test_getcode(self): self.assertIsNone(self.returned_obj.getcode()) - self.assertIsNone(self.returned_obj.status) def test_iter(self): # Test iterator From 73a5a9a1b8ef3c5fe8ba03c42cec9878b4df7574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 15 Jan 2019 13:37:57 -0800 Subject: [PATCH 21/28] Update Lib/urllib/request.py Co-Authored-By: epicfaace --- Lib/urllib/request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index cda2b7f5b8683e..4431d6cacb2deb 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -166,7 +166,7 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, This function always returns an object which can work as a :term:`context manager` and has the properties `url`, `headers`, and `status`. - See `urllib.response.addinfourl` for more detail on these properties. + See :class:`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 From 1f8b27bdc10e79f06a0949698b81205e4783e68b Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 15 Jan 2019 14:02:11 -0800 Subject: [PATCH 22/28] bpo-12707: fix indentation and formatting --- Doc/library/urllib.request.rst | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index e87b2f596c059d..2451d23526d3f5 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1553,34 +1553,34 @@ minimal file-like interface, including ``read()`` and ``readline()``. Functions defined by this module are used internally by the :mod:`urllib.request` module. The typical response object is a :class:`urllib.response.addinfourl` instance: -.. class:: urllib.response.addinfourl +.. class:: addinfourl -.. attribute:: addinfourl.url + .. attribute:: url - URL of the resource retrieved, commonly used to determine if a redirect was followed. + URL of the resource retrieved, commonly used to determine if a redirect was followed. -.. attribute:: addinfourl.headers + .. attribute:: headers - Returns the headers of the response in the form of an :class:`~email.message.EmailMessage` instance. + Returns the headers of the response in the form of an :class:`~email.message.EmailMessage` instance. -.. attribute:: addinfourl.status + .. attribute:: status - .. versionadded:: 3.8 + .. versionadded:: 3.8 - Status code returned by server. + Status code returned by server. -.. method:: addinfourl.geturl() + .. method:: geturl() - Deprecated method equivalent to :attr:`~addinfourl.url`. + Deprecated method equivalent to :attr:`~addinfourl.url`. -.. method:: addinfourl.info() + .. method:: info() - Deprecated method equivalent to :attr:`~addinfourl.headers`. + Deprecated method equivalent to :attr:`~addinfourl.headers`. -.. attribute:: addinfourl.code + .. attribute:: code - Deprecated attribute equivalent to :attr:`~addinfourl.status`. + Deprecated attribute equivalent to :attr:`~addinfourl.status`. -.. method:: addinfourl.getstatus() + .. method:: getstatus() - Deprecated method equivalent to :attr:`~addinfourl.status`. + Deprecated method equivalent to :attr:`~addinfourl.status`. From c9e81101c60a603c8c60c511ecd7ac73729b0c14 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 15 Jan 2019 14:04:08 -0800 Subject: [PATCH 23/28] bpo-12707: fix indentation --- Lib/urllib/request.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 4431d6cacb2deb..58f803377d99c7 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -164,9 +164,9 @@ 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 - :term:`context manager` and has the properties `url`, `headers`, and `status`. - See :class:`urllib.response.addinfourl` for more detail on these properties. + This function always returns an object which can work as a + :term:`context manager` and has the properties `url`, `headers`, and `status`. + See :class:`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 From 61385d865b456a069f2bf88ac8f7fc919057697b Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 15 Jan 2019 14:57:17 -0800 Subject: [PATCH 24/28] bpo-12707: remove reST from docstring --- Lib/urllib/request.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 58f803377d99c7..40513bb75d0ccf 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -165,8 +165,8 @@ def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, This function always returns an object which can work as a - :term:`context manager` and has the properties `url`, `headers`, and `status`. - See :class:`urllib.response.addinfourl` for more detail on these properties. + 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 From 2ee88ddc6dd14b135002cc0b6969cca8714f9059 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2019 01:15:04 +0000 Subject: [PATCH 25/28] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst diff --git a/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst b/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst new file mode 100644 index 00000000000000..7971eb4edd8afd --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst @@ -0,0 +1 @@ +Deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl. Patch by Ashwin Ramaswami \ No newline at end of file From d7575f0bbb3c4c3e9ea69cc840050d16a94780e1 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Fri, 13 Sep 2019 04:24:41 +0000 Subject: [PATCH 26/28] Make NEWS more clear --- .../next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst b/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst index 7971eb4edd8afd..423e8310d73749 100644 --- a/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst +++ b/Misc/NEWS.d/next/Documentation/2019-08-27-01-14-59.bpo-12707.Yj3_7_.rst @@ -1 +1 @@ -Deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl. Patch by Ashwin Ramaswami \ No newline at end of file +Deprecate info(), geturl(), getcode() methods in favor of the headers, url, and status properties, respectively, for HTTPResponse and addinfourl. Also deprecate the code attribute of addinfourl in favor of the status attribute. Patch by Ashwin Ramaswami \ No newline at end of file From 628c2f066595a96ce7aaf3e6d23b8c9ac9a3a171 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Fri, 13 Sep 2019 04:25:19 +0000 Subject: [PATCH 27/28] add Deprecated warnings and update versionadded --- Doc/library/http.client.rst | 9 ++++++--- Doc/library/urllib.request.rst | 14 +++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index eac73fd73eeacb..557f32eba334f4 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -487,15 +487,18 @@ statement. .. method:: HTTPResponse.geturl() - Deprecated method equivalent to :attr:`HTTPResponse.url`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~HTTPResponse.url`. .. method:: HTTPResponse.info() - Deprecated method equivalent to :attr:`HTTPResponse.headers`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~HTTPResponse.headers`. .. method:: HTTPResponse.getstatus() - Deprecated method equivalent to :attr:`~HTTPResponse.status`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~HTTPResponse.status`. Examples -------- diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 2451d23526d3f5..8fb206b28090cd 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1565,22 +1565,26 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. attribute:: status - .. versionadded:: 3.8 + .. versionadded:: 3.9 Status code returned by server. .. method:: geturl() - Deprecated method equivalent to :attr:`~addinfourl.url`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~addinfourl.url`. .. method:: info() - Deprecated method equivalent to :attr:`~addinfourl.headers`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~addinfourl.headers`. .. attribute:: code - Deprecated attribute equivalent to :attr:`~addinfourl.status`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~addinfourl.status`. .. method:: getstatus() - Deprecated method equivalent to :attr:`~addinfourl.status`. + ..deprecated:: 3.9 + Deprecated in favor of :attr:`~addinfourl.status`. From 5f5b2f91c84afd40249a6086331f64cd51e175f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Fri, 13 Sep 2019 12:57:46 +0200 Subject: [PATCH 28/28] Fix the call of the 'deprecated' directive --- Doc/library/http.client.rst | 6 +++--- Doc/library/urllib.request.rst | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 557f32eba334f4..9e37fd96b727f4 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -487,17 +487,17 @@ statement. .. method:: HTTPResponse.geturl() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~HTTPResponse.url`. .. method:: HTTPResponse.info() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~HTTPResponse.headers`. .. method:: HTTPResponse.getstatus() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~HTTPResponse.status`. Examples diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 8fb206b28090cd..c3fdcf136aec9c 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1571,20 +1571,20 @@ The typical response object is a :class:`urllib.response.addinfourl` instance: .. method:: geturl() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~addinfourl.url`. .. method:: info() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~addinfourl.headers`. .. attribute:: code - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~addinfourl.status`. .. method:: getstatus() - ..deprecated:: 3.9 + .. deprecated:: 3.9 Deprecated in favor of :attr:`~addinfourl.status`.