Warning: Unclosed client session / Unclosed connector
Got these warnings. Should I close the session and how can I do it?
Also receiving these warnings. To reproduce:
import asyncio from aiohttp import ClientSession from blinkpy.blinkpy import Blink from blinkpy.auth import Auth
async def start(): ....blink = Blink(session=ClientSession()) ....# In the following XXX are replaced with my username and my password ....auth = Auth({"username": XXX, "password": XXX}, no_prompt=True) ....blink.auth = auth ....await blink.start() ....return blink
blink = asyncio.run(start())
Follow something like this example. https://github.com/fronzbot/blinkpy/blob/7d0e1f6cbb4b571c556e1e7c8ee1d87d1f0257d3/blinksync/blinksync.py#L102-L103
Follow something like this example.
https://github.com/fronzbot/blinkpy/blob/7d0e1f6cbb4b571c556e1e7c8ee1d87d1f0257d3/blinksync/blinksync.py#L102-L103
Understood, but what to do after aborting (^C) a run while a seesion is open? How to check for and close a zombie session?
It doesn't really matter, when you ^C it kills python - it's just a warning informing you that things were not closed as they should be programmatically.
You may be able to put a try: test around the whole code and catch except KeyboardInterrupt: then close the session if you really need it.
There hasn't been any activity on this issue recently. Please make sure to update to the latest blinkpy version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.