使用ProxyBroker构建代理池

2020-09-17 10:16:05 浏览数 (1)

代码语言:javascript复制
import  asyncio
from proxybroker import Broker

async def show(proxies):
    while True:
        proxy = await proxies.get()
        if proxy is None: break
        print('Found proxy: %s' % proxy)

proxies = asyncio.Queue()
broker=Broker(proxies)
tasks=asyncio.gather(broker.find(types=['HTTP','HTTPS'],limit=10),show(proxies))
loop=asyncio.get_event_loop()
loop.run_until_complete(tasks)

0 人点赞