(
proxy: Proxy,
ws_uri: WebSocketURI,
user_agent_header: str | None = None,
**kwargs: Any,
)
| 782 | |
| 783 | |
| 784 | async 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 |
no test coverage detected
searching dependent graphs…