From fbdb8ce7c819270a9bd3b933cdb4aa64a07d1822 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Fri, 9 Jan 2026 12:50:41 +0400 Subject: [PATCH] [http.client] Deprecate HTTPResponse methods Docs: https://docs.python.org/dev/library/http.client.html#http.client.HTTPResponse.geturl --- stdlib/http/client.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index 1568567d5854..7357fea6530f 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -8,7 +8,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping from email._policybase import _MessageT from socket import socket from typing import BinaryIO, Final, TypeVar, overload -from typing_extensions import Self, TypeAlias +from typing_extensions import Self, TypeAlias, deprecated __all__ = [ "HTTPResponse", @@ -160,8 +160,11 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None ) -> None: ... + @deprecated("Deprecated since Python 3.9. Use `HTTPResponse.headers` attribute instead.") def info(self) -> email.message.Message: ... + @deprecated("Deprecated since Python 3.9. Use `HTTPResponse.url` attribute instead.") def geturl(self) -> str: ... + @deprecated("Deprecated since Python 3.9. Use `HTTPResponse.status` attribute instead.") def getcode(self) -> int: ... def begin(self) -> None: ...