1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
# Usage
## Installation
```bash
pip install aioguardian
```
## Python Versions
`aioguardian` is currently supported on:
- Python 3.9
- Python 3.10
- Python 3.11
## Get Up and Running
Getting up and running with `aioguardian` is very simple! Merely create a
{meth}`Client <aioguardian.Client>` class with the IP address of the device and get to
work:
```python
import asyncio
from aioguardian import Client
async def main():
client = Client("<IP ADDRESS>")
# Note that connecting to the Guardian is accomplished via a coroutine:
await client.connect()
# ...run commands...
# Note that disconnecting from the Guardian is accomplished via a regular method:
client.disconnect()
asyncio.run(main())
```
If you would prefer, the {meth}`Client <aioguardian.Client>` class also comes with a
context manager that handles connection/disconnection for you:
```python
import asyncio
from aioguardian import Client
async def main():
async with Client("<IP ADDRESS>") as client:
# ...run commands...
pass
asyncio.run(main())
```
|