From 081905954db489eb4a551117e1ab31590e833012 Mon Sep 17 00:00:00 2001 From: Alexandr Mitin Date: Thu, 17 Apr 2025 23:02:21 +0600 Subject: [PATCH 1/7] Updated to the latest version --- Lib/test/test_urllib2.py | 2 +- Lib/urllib/request.py | 7 +++---- Misc/ACKS | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 7d7f2fa00d35b6..798da7e7fa9cd3 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -300,7 +300,7 @@ def getheaders(self, name): class MockResponse(io.StringIO): def __init__(self, code, msg, headers, data, url=None): io.StringIO.__init__(self, data) - self.code, self.msg, self.headers, self.url = code, msg, headers, url + self.status, self.msg, self.headers, self.url = code, msg, headers, url def info(self): return self.headers diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 9a6b29a90a2968..74a93aa8ff6642 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -210,7 +210,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None): url_type, path = _splittype(url) with contextlib.closing(urlopen(url, data)) as fp: - headers = fp.info() + headers = fp.headers # Just return the local path and the "headers" for file:// # URLs. No sense in performing a copy unless requested. @@ -594,7 +594,7 @@ class HTTPErrorProcessor(BaseHandler): handler_order = 1000 # after all other processing def http_response(self, request, response): - code, msg, hdrs = response.code, response.msg, response.info() + code, msg, hdrs = response.status, response.msg, response.info() # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. @@ -1338,8 +1338,7 @@ def do_open(self, http_class, req, **http_conn_args): # This line replaces the .msg attribute of the HTTPResponse # with .headers, because urllib clients expect the response to # have the reason in .msg. It would be good to mark this - # attribute is deprecated and get then to use info() or - # .headers. + # attribute is deprecated and get then to use .headers. r.msg = r.reason return r diff --git a/Misc/ACKS b/Misc/ACKS index 25542d01de695c..713c3e12b2cd5a 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1270,6 +1270,7 @@ Dustin J. Mitchell Gideon Mitchell Tim Mitchell Zubin Mithra +Alexandr Mitin Florian Mladitsch Kevin Modzelewski Doug Moen From 2787cbef45b96db94713548bdc055153173712ae Mon Sep 17 00:00:00 2001 From: Alexandr Mitin Date: Thu, 17 Apr 2025 23:23:31 +0600 Subject: [PATCH 2/7] fix error --- 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 74a93aa8ff6642..a4e83d0226ebf3 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1006,7 +1006,7 @@ def http_request(self, req): def http_response(self, req, response): if hasattr(self.passwd, 'is_authenticated'): - if 200 <= response.code < 300: + if 200 <= response.status < 300: self.passwd.update_authenticated(req.full_url, True) else: self.passwd.update_authenticated(req.full_url, False) From ded5640904527f2df420d7542dc4fa0d2f00dfa8 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:13:49 +0000 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst diff --git a/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst b/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst new file mode 100644 index 00000000000000..9d093a06a718fd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst @@ -0,0 +1 @@ +Replaced usage of deprecated attributes `addinfourl.status` and `HTTPResponse.info` with their modern equivalents. From c9028b564abd18d2d3a5cf557dcd8ef1ef698e7b Mon Sep 17 00:00:00 2001 From: Alexandr Mitin <64941904+Alexandr153@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:18:13 +0600 Subject: [PATCH 4/7] replacing deprecated `info()` --- 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 a4e83d0226ebf3..a51716915db263 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -594,7 +594,7 @@ class HTTPErrorProcessor(BaseHandler): handler_order = 1000 # after all other processing def http_response(self, request, response): - code, msg, hdrs = response.status, response.msg, response.info() + code, msg, hdrs = response.status, response.msg, response.headers # According to RFC 2616, "2xx" code indicates that the client's # request was successfully received, understood, and accepted. From ad3599216ed132c7f9ee78ddd584d3f559bfb4bc Mon Sep 17 00:00:00 2001 From: Alexandr Mitin <64941904+Alexandr153@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:33:21 +0600 Subject: [PATCH 5/7] Update 2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst --- .../Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst b/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst index 9d093a06a718fd..f7d03e8a3d301e 100644 --- a/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst +++ b/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst @@ -1 +1,2 @@ -Replaced usage of deprecated attributes `addinfourl.status` and `HTTPResponse.info` with their modern equivalents. +Deprecated attributes `urllib.response.addinfourl.status` and `http.client.HTTPResponse.info()` +have been replaced with their modern equivalents (`HTTPResponse.headers`) while maintaining backwards-compatibility. From ce6e8eadc02563aaab8c37f7e87b7043a9c0fb1b Mon Sep 17 00:00:00 2001 From: Alexandr Mitin <64941904+Alexandr153@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:36:58 +0600 Subject: [PATCH 6/7] Delete Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst --- .../next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst diff --git a/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst b/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst deleted file mode 100644 index f7d03e8a3d301e..00000000000000 --- a/Misc/NEWS.d/next/Library/2025-04-17-18-13-46.gh-issue-123503.Qtuolv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Deprecated attributes `urllib.response.addinfourl.status` and `http.client.HTTPResponse.info()` -have been replaced with their modern equivalents (`HTTPResponse.headers`) while maintaining backwards-compatibility. From d89066bfe9f974fffb720f1336622dbbed85bf3c Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:37:28 +0000 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-04-17-18-37-26.gh-issue-123503.mfg0wD.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-04-17-18-37-26.gh-issue-123503.mfg0wD.rst diff --git a/Misc/NEWS.d/next/Library/2025-04-17-18-37-26.gh-issue-123503.mfg0wD.rst b/Misc/NEWS.d/next/Library/2025-04-17-18-37-26.gh-issue-123503.mfg0wD.rst new file mode 100644 index 00000000000000..dbd7b8b3b474c4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-04-17-18-37-26.gh-issue-123503.mfg0wD.rst @@ -0,0 +1 @@ +Deprecated attributes urllib.response.addinfourl.status and http.client.HTTPResponse.info() have been replaced with their modern equivalents (HTTPResponse.headers) while maintaining backwards-compatibility.