Skip to content
New issue

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

AOSmithAPIClient Raises RuntimeError: no running event loop #5

Closed
AlanLivingston opened this issue Nov 23, 2024 · 2 comments
Closed

Comments

@AlanLivingston
Copy link

AlanLivingston commented Nov 23, 2024

Running Python v3.13.0 64-bit version in a virtualenv created virtual environment.

I get the following error:

from py_aosmith import AOSmithAPIClient
from py_aosmith.models import OperationMode
client = AOSmithAPIClient("REDACTED@gmail.com", "REDACTED")
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    client = AOSmithAPIClient("REDACTED@gmail.com", "REDACTED")
  File "d:\water_heater_test\env\Lib\site-packages\py_aosmith\client.py", line 183, in __init__
    self.session = aiohttp.ClientSession()
  File "d:\water_heater_test\env\Lib\site-packages\aiohttp\client.py", line 310, in __init__
    loop = loop or asyncio.get_running_loop()
RuntimeError: no running event loop
@AlanLivingston
Copy link
Author

Looks like a change to aiohttp. See aio-libs/aiohttp#8555

@AlanLivingston
Copy link
Author

AlanLivingston commented Nov 23, 2024

I think I was misunderstanding how to use the module. I was able to get it running with some tweaks to the example:

async def test():
    async with aiohttp.ClientSession() as sess:
        client = AOSmithAPIClient('REDACTED@gmail.com', 'REDACTED', sess)
        
        info = await client.get_all_device_info()
        return info


if __name__ == "__main__":
    asyncio.run(test())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant