import asyncio

import aiohttp
from aiosocksy.connector import ProxyConnector, ProxyClientRequest


async def fetch(url):
    connector = ProxyConnector()
    socks = 'socks5://127.0.0.1:12377'
    async with aiohttp.ClientSession(connector=connector, request_class=ProxyClientRequest) as session:
        async with session.get(url, proxy=socks) as response:
            print(await response.text())


loop = asyncio.get_event_loop()
loop.run_until_complete(fetch('https://www.google.com'))

  

相关文章:

  • 2021-12-03
  • 2021-09-28
  • 2021-12-25
  • 2021-08-25
  • 2021-07-25
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-05-31
  • 2021-05-12
  • 2021-09-28
相关资源
相似解决方案