diff --git a/changelog.d/17536.misc b/changelog.d/17536.misc new file mode 100644 index 00000000000..116ef0c36d1 --- /dev/null +++ b/changelog.d/17536.misc @@ -0,0 +1 @@ +Replace override of deprecated method `HTTPAdapter.get_connection` with `get_connection_with_tls_context`. \ No newline at end of file diff --git a/scripts-dev/federation_client.py b/scripts-dev/federation_client.py index bb2d690a841..fb879ef5555 100755 --- a/scripts-dev/federation_client.py +++ b/scripts-dev/federation_client.py @@ -298,22 +298,6 @@ def send( return super().send(request, *args, **kwargs) - # def get_connection( - # self, url: str, proxies: Optional[Dict[str, str]] = None, - # ) -> HTTPConnectionPool: - # # overrides the get_connection() method in the base class - # parsed = urlparse.urlsplit(url) - # (host, port, ssl_server_name) = self._lookup(parsed.netloc) - # print( - # f"Connecting to {host}:{port} with SNI {ssl_server_name}", file=sys.stderr - # ) - # return self.poolmanager.connection_from_host( - # host, - # port=port, - # scheme="https", - # pool_kwargs={"server_hostname": ssl_server_name}, - # ) - def get_connection_with_tls_context( self, request: PreparedRequest, @@ -322,11 +306,9 @@ def get_connection_with_tls_context( cert: Optional[Union[Tuple[str, str], str]] = None, ) -> HTTPConnectionPool: # overrides the get_connection_with_tls_context() method in the base class - # return self.get_connection(request.url, proxies) - # overrides the get_connection() method in the base class parsed = urlparse.urlsplit(request.url) - # Extract the hostname from the request URL and ensure it's a str. + # Extract the server name from the request URL, and ensure it's a str. hostname = parsed.netloc if isinstance(hostname, bytes): hostname = hostname.decode("utf-8")