MCPcopy Create free account
hub / github.com/python-websockets/websockets / connect_http_proxy

Function connect_http_proxy

src/websockets/asyncio/client.py:784–804  ·  view source on GitHub ↗
(
    proxy: Proxy,
    ws_uri: WebSocketURI,
    user_agent_header: str | None = None,
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

782
783
784async def connect_http_proxy(
785 proxy: Proxy,
786 ws_uri: WebSocketURI,
787 user_agent_header: str | None = None,
788 **kwargs: Any,
789) -> asyncio.Transport:
790 transport, protocol = await asyncio.get_running_loop().create_connection(
791 lambda: HTTPProxyConnection(ws_uri, proxy, user_agent_header),
792 proxy.host,
793 proxy.port,
794 **kwargs,
795 )
796
797 try:
798 # This raises exceptions if the connection to the proxy fails.
799 await protocol.response
800 except Exception:
801 transport.close()
802 raise
803
804 return transport

Callers 1

create_connectionMethod · 0.70

Calls 3

HTTPProxyConnectionClass · 0.85
create_connectionMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…