From b57f03e23aaf6d4862f3af477d1bae0d313ebdb5 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Fri, 5 Jul 2024 07:11:53 +0000 Subject: [PATCH] Add example --- examples/test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/test.py diff --git a/examples/test.py b/examples/test.py new file mode 100644 index 0000000..a82ee01 --- /dev/null +++ b/examples/test.py @@ -0,0 +1,21 @@ +"""Test file for Sensibo.""" + +from __future__ import annotations + +import asyncio + +import aiohttp + +from pysensibo import SensiboClient + + +async def main(event_loop: asyncio.AbstractEventLoop) -> None: + """Retrieve device information from Sensibo cloud.""" + async with aiohttp.ClientSession(loop=event_loop) as session: + client = SensiboClient("API_KEY", session) + devices = await client.async_get_devices_data() + print(devices) # noqa: T201 + + +loop = asyncio.get_event_loop() +loop.run_until_complete(main(loop))