Closed bakaInc closed 4 years ago
@bakaInc This problem still exists, I don't know if there is any problem? my code A is:
import asyncio
from proxybroker2 import Broker
import logging
logging.basicConfig(level=logging.INFO)
async def find_proxy():
loop = asyncio.get_event_loop()
queue = asyncio.Queue()
broker = Broker(queue, loop=loop)
await broker.find(types=["HTTP", "HTTPS"], limit=20, lvl="High", strict=True)
while broker._all_tasks:
await asyncio.sleep(1)
if broker:
broker.stop()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(find_proxy())
# asyncio.run(find_proxy())
This code works fine
my code B is:
import asyncio
from proxybroker2 import Broker
import logging
logging.basicConfig(level=logging.INFO)
async def find_proxy():
loop = asyncio.get_event_loop()
queue = asyncio.Queue()
broker = Broker(queue, loop=loop)
await broker.find(types=["HTTP", "HTTPS"], limit=20, lvl="High", strict=True)
while broker._all_tasks:
await asyncio.sleep(1)
if broker:
broker.stop()
if __name__ == '__main__':
# loop = asyncio.get_event_loop()
# loop.run_until_complete(find_proxy())
asyncio.run(find_proxy())
This code stuck warning:
I need to use a new loop in project so when i use asyncio with new loop i get error the code work fine if not attached new loop to asyncio
When run with
i got warnings and no proxy print, program don't stop