async def main(): proxy = ProxyChain([ Proxy.from_url(SOCKS5_IPV4_URL), Proxy.from_url(SOCKS4_URL), Proxy.from_url(HTTP_PROXY_URL), ]) # noinspection PyTypeChecker status_code = await make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
async def main(): proxy = Proxy.from_url(SOCKS5_IPV4_HOSTNAME_URL) status_code = await make_request( proxy=proxy, url=url, ) assert status_code == 200
async def main(): proxy = Proxy.create( proxy_type=ProxyType.SOCKS5, host=SOCKS5_IPV4_HOST, port=SOCKS5_IPV4_PORT, username=LOGIN, password=PASSWORD + 'aaa', ) with pytest.raises(ProxyError): await make_request(proxy=proxy, url=TEST_URL)
async def main(): proxy = Proxy.create( proxy_type=ProxyType.SOCKS5, host=SOCKS5_IPV4_HOST, port=unused_tcp_port, username=LOGIN, password=PASSWORD, ) with pytest.raises(ProxyConnectionError): await make_request(proxy=proxy, url=TEST_URL)
async def main(): proxy = Proxy.create( proxy_type=ProxyType.SOCKS5, host=PROXY_HOST_IPV4, port=SOCKS5_PROXY_PORT, username=LOGIN, password=PASSWORD, ) with pytest.raises(ProxyTimeoutError): await make_request(proxy=proxy, url=TEST_URL_IPV4, timeout=0.0001)
async def main(): proxy = Proxy.from_url(SOCKS5_IPV4_URL_WO_AUTH, rdns=rdns) status_code = await make_request(proxy=proxy, url=TEST_URL) assert status_code == 200
async def main(): proxy = Proxy.from_url(SOCKS5_IPV4_URL, rdns=rdns) status_code = await make_request(proxy=proxy, url=TEST_URL, resolve_host=resolve_host) assert status_code == 200
async def main(): proxy = Proxy.from_url(HTTP_PROXY_URL) status_code = await make_request(proxy=proxy, url=TEST_URL) assert status_code == 200