awtrix-light HTTP client to be used with Ulanzi clock
Project description
Python async HTTP client for awtrix-light
Warning
This client has been tested with awtrix-light v0.90 use with caution as official dev documentation is not fully documented and can cause crash
Install
pip install awtrix-light-client
Dev
Install Poetry
Install and setup dependencies
poetry install
poetry shell
Usage
Official project documentation : https://blueforcer.github.io/awtrix-light/#/api
Available environment variables
AWTRIX_HTTP_CLIENT_AWTRIX="<AWTRIX CONFIG>"
<AWTRIX CONFIG>
is in JSON and looks like this :
{
"base_url": "http://192.168.0.1",
"username": "admin",
"password": "password",
"verify_ssl": false
}
verify_ssl
used to verify https config (if accessing behind an HTTPS reverse proxy), can be true
, false
, or can point to a local ca bundle PEM encoded to validate local CA
Example script
import asyncio
from awtrix_light_client.http_client import get_awtrix_http_client, AwtrixLightHttpClientError
async def main():
try:
async with get_awtrix_http_client() as client:
stats = await client.get_stats()
print(stats)
except AwtrixLightHttpClientError as e:
print(f"HTTP code: {e.status_code}, error content: {e.content}")
asyncio.run(main())
Run unit test
poetry run pytest --cov
Run black
poetry run black .
Licence
The code is under CeCILL license.
You can find all details here: https://cecill.info/licences/Licence_CeCILL_V2.1-en.html
Credits
Copyright © Ludovic Ortega, 2023
Contributor(s):
-Ortega Ludovic - ludovic.ortega@adminafk.fr
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for awtrix_light_client-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c56b14d04e987831ca267f2240dc0e4b5057f71d93f8a650de1e2b0f6e08a516 |
|
MD5 | 2dc0a3d5b0a25878b57238a45aab3f86 |
|
BLAKE2b-256 | e37f6f0e98be273c12965e097fb10e89ad7d75e12e06d579e950210ffe49ea4b |
Hashes for awtrix_light_client-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d89538244748f0c890e95ce1d69d9a23a7b180d17f040a2428a89059de2c226 |
|
MD5 | 1839c126a94844c2c87c739662d6342e |
|
BLAKE2b-256 | 63771f134423b8c905e7d15b1ec48198ba4ad97719a5c0421a7eda18d38e40c0 |