MCPcopy
hub / github.com/urllib3/urllib3 / set_tunnel

Method set_tunnel

src/urllib3/connection.py:227–239  ·  view source on GitHub ↗
(
        self,
        host: str,
        port: int | None = None,
        headers: typing.Mapping[str, str] | None = None,
        scheme: str = "http",
    )

Source from the content-addressed store, hash-verified

225 return sock
226
227 def set_tunnel(
228 self,
229 host: str,
230 port: int | None = None,
231 headers: typing.Mapping[str, str] | None = None,
232 scheme: str = "http",
233 ) -> None:
234 if scheme not in ("http", "https"):
235 raise ValueError(
236 f"Invalid proxy scheme for tunneling: {scheme!r}, must be either 'http' or 'https'"
237 )
238 super().set_tunnel(host, port=port, headers=headers)
239 self._tunnel_scheme = scheme
240
241 if sys.version_info < (3, 11, 9) or ((3, 12) <= sys.version_info < (3, 12, 3)):
242 # Taken from python/cpython#100986 which was backported in 3.11.9 and 3.12.3.

Callers 5

test_set_tunnel_is_resetFunction · 0.45
test_tunnelMethod · 0.45
test_tunnelMethod · 0.45
_prepare_proxyMethod · 0.45

Calls

no outgoing calls

Tested by 4

test_set_tunnel_is_resetFunction · 0.36
test_tunnelMethod · 0.36
test_tunnelMethod · 0.36