예제 #1
0
async def test_chain_proxy_ctor(url, rdns):
    connector = ChainProxyConnector([
        ProxyInfo(proxy_type=ProxyType.SOCKS5,
                  host=SOCKS5_IPV4_HOST,
                  port=SOCKS5_IPV4_PORT,
                  username=LOGIN,
                  password=PASSWORD,
                  rdns=rdns),
        ProxyInfo(proxy_type=ProxyType.SOCKS4,
                  host=SOCKS4_HOST,
                  port=SOCKS4_PORT,
                  rdns=rdns),
        ProxyInfo(proxy_type=ProxyType.HTTP,
                  host=HTTP_PROXY_HOST,
                  port=HTTP_PROXY_PORT,
                  username=LOGIN,
                  password=PASSWORD),
    ])
    async with aiohttp.ClientSession(connector=connector) as session:
        async with session.get(url) as resp:
            assert resp.status == 200
예제 #2
0
async def test_chain_proxy_ctor(url, rdns):
    connector = ChainProxyConnector([
        ProxyInfo(proxy_type=ProxyType.SOCKS5,
                  host=PROXY_HOST_IPV4,
                  port=SOCKS5_PROXY_PORT,
                  username=LOGIN,
                  password=PASSWORD,
                  rdns=rdns),
        ProxyInfo(proxy_type=ProxyType.SOCKS4,
                  host=PROXY_HOST_IPV4,
                  port=SOCKS4_PROXY_PORT,
                  username=LOGIN,
                  rdns=rdns),
        ProxyInfo(proxy_type=ProxyType.HTTP,
                  host=PROXY_HOST_IPV4,
                  port=HTTP_PROXY_PORT,
                  username=LOGIN,
                  password=PASSWORD),
    ])
    res = await fetch(connector=connector, url=url)
    assert res.status == 200
예제 #3
0
async def test_chain_proxy_from_url(url):
    connector = ChainProxyConnector.from_urls(
        [SOCKS5_IPV4_URL, SOCKS4_URL, HTTP_PROXY_URL])
    async with aiohttp.ClientSession(connector=connector) as session:
        async with session.get(url) as resp:
            assert resp.status == 200
예제 #4
0
async def test_chain_proxy_from_url(url):
    connector = ChainProxyConnector.from_urls(
        [SOCKS5_IPV4_URL, SOCKS4_URL, HTTP_PROXY_URL])
    res = await fetch(connector=connector, url=url)
    assert res.status == 200