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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6345a835ac45db994d83463776beff7f8c376f40b4de222587b32ee2ec316ed9 |
|
MD5 | 8d5374cf722c8b609b9f625fc5b3ac2d |
|
BLAKE2b-256 | ed7e885cbc8503482a5bdc97591050e85432ced43d7e7c770892d9dbecccc6b7 |
Hashes for awtrix_light_client-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 250f3fd0a82a1617b500bb881fbfdf07bfc3824330f6f4d4d4f42af77c30253b |
|
MD5 | 249b20e4a038eedca900ddcc6dfe4a04 |
|
BLAKE2b-256 | 7da69c8c4fb21763c4a2a40eb03e45146302dd1c0b74a1bf1e5497188a07ad60 |