Код: Выделить всё
def async_aiohttp_get_all(self, urls):
"""
performs asynchronous get requests
"""
async def get_all(urls):
async with aiohttp.ClientSession(connector_owner=False) as session:
async def fetch(url):
async with session.get(url) as response:
#return await response.json()
rtn = {"url": response.url,
"content": await response.text()}
return rtn
rslts = await asyncio.gather(*[
fetch(url) for url in urls
])
return rslts
# call get_all as a sync function to be used in a sync context
return sync.async_to_sync(get_all)(urls)
Код: Выделить всё
Unclosed connector
connections: ['[(, 10368.656), (, 10368.671), (, 10368.687), (, 10368.75), (, 10369.078)]']
connector:
Кто-нибудь может мне помочь?
Подробнее здесь: https://stackoverflow.com/questions/790 ... s-sessions