From 464b71c810f916e66e5c5bb9208e77b298fd76c6 Mon Sep 17 00:00:00 2001 From: James Braza Date: Fri, 21 Jul 2023 17:58:13 -0700 Subject: [PATCH] Added `url: str` to `http.client.HTTPResponse` (#10497) --- stdlib/http/client.pyi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index 41ece1b05..4b5ed3d8b 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -115,6 +115,10 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore[misc] # incomp chunk_left: int | None length: int | None will_close: bool + # url is set on instances of the class in urllib.request.AbstractHTTPHandler.do_open + # to match urllib.response.addinfourl's interface. + # It's not set in HTTPResponse.__init__ or any other method on the class + url: str def __init__(self, sock: socket, debuglevel: int = 0, method: str | None = None, url: str | None = None) -> None: ... def peek(self, n: int = -1) -> bytes: ... def read(self, amt: int | None = None) -> bytes: ...