-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from andrey-git/examples
Add test example file
- Loading branch information
Showing
2 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,10 +363,6 @@ target/ | |
|
||
# Virtual environment | ||
venv/ | ||
# Test purpose only | ||
ferry_test.py | ||
|
||
# Mypy cache | ||
.mypy_cache | ||
|
||
test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |