tell asyncio.gather which loop to use

This commit is contained in:
jesopo 2019-07-08 14:41:12 +01:00
parent a1438abf66
commit 469c725675

View file

@ -131,7 +131,7 @@ def request_many(urls: typing.List[str]) -> typing.Dict[str, Response]:
awaits = [] awaits = []
for url in urls: for url in urls:
awaits.append(_request(url)) awaits.append(_request(url))
task = asyncio.gather(*awaits, return_exceptions=True) task = asyncio.gather(*awaits, return_exceptions=True, loop=loop)
loop.run_until_complete(task) loop.run_until_complete(task)
loop.close() loop.close()