We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000153A95E9E10>
it shows the error above.
================================ here is my code:
class Test:
# use aiohttp async def aio_get(self, session=None, url='', params={}, headers={}, proxy='', timeout=10, verify_ssl=False): try: async with session.get(url=url, params=params, headers=headers, proxy=proxy, verify_ssl=verify_ssl) as resp: r = await resp.read() return r except: return None # main async def async_verify(self, work_id:int=1, work_count:int=100000): for x in range(work_count): session = aiohttp.ClientSession() content = await self.aio_get(session=session, url=home_url, params={}, headers=headers, proxy=proxies, verify_ssl=False) if content is None: continue # do something content = await self.aio_get(session=session, url=home_url, params={}, headers=headers, proxy=proxies, verify_ssl=False) if content is None: continue # do something # do something # do something session.close() # run loop def start(self): loop = asyncio.get_event_loop() tasks = [] for i in range(10): task = asyncio.ensure_future(self.async_verify(work_id=i, work_count=work_count)) tasks.append(task) loop.run_until_complete(asyncio.wait(tasks))
The text was updated successfully, but these errors were encountered:
If content is None: continue
When you continue you will never come to session.close()
Could that be your problem?
Sorry, something went wrong.
Have a look at this: #4257
I'll close this here but you can ask your question over on discourse in case my answer doesn't solve it.
No branches or pull requests
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000153A95E9E10>
it shows the error above.
================================
here is my code:
class Test:
The text was updated successfully, but these errors were encountered: