MCPcopy
hub / github.com/encode/httpx / test_socks_proxy

Function test_socks_proxy

tests/client/test_proxies.py:16–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15
16def test_socks_proxy():
17 url = httpx.URL("http://www.example.com")
18
19 for proxy in ("socks5://localhost/", "socks5h://localhost/"):
20 client = httpx.Client(proxy=proxy)
21 transport = client._transport_for_url(url)
22 assert isinstance(transport, httpx.HTTPTransport)
23 assert isinstance(transport._pool, httpcore.SOCKSProxy)
24
25 async_client = httpx.AsyncClient(proxy=proxy)
26 async_transport = async_client._transport_for_url(url)
27 assert isinstance(async_transport, httpx.AsyncHTTPTransport)
28 assert isinstance(async_transport._pool, httpcore.AsyncSOCKSProxy)
29
30
31PROXY_URL = "http://[::1]"

Callers

nothing calls this directly

Calls 2

_transport_for_urlMethod · 0.95
_transport_for_urlMethod · 0.95

Tested by

no test coverage detected