apykuma
Small library to notify Uptime Kuma that the service is up. Only async applications are supported.
Usage
Firstly, install the library:
pip install apykuma
Then include it in your code:
import logging
import apykuma
await apykuma.start(
# Required; Push URL from Kuma GUI
url="https://my-service.com",
# Optional; default is 60 seconds
interval=60,
# Optional; sleeps for N seconds before pinging Kuma, in case if you run `apykuma` right before starting your service
# (if service fails, `apykuma` won't start as well). The recommended value is 10 seconds
delay=0,
# Optional; function that is called when during ping we encourage an error
# it is done to notify you about (e.g.) network errors, and to not
# stop the process of pinging kuma on such errors
#
# by default, it logs an error using `logging` library (default value is shown below),
# also supports async functions
handle_exception=lambda e: logging.getLogger("apykuma").exception(e),
)
It is important to start apykuma after your service starts.
Differences from pykuma
https://github.com/oliverstech/pykuma
That library is great, but it has some problems:
- It uses globals, which I personally don't like
- It blocks the loop every time it sends a request, because it uses
requestslibrary instead ofaiohttp. See also https://github.com/oliverstech/pykuma/issues/2.
Installing for local developing
git clone https://github.com/PerchunPak/apykuma.git
cd apykuma
Installing poetry
Next we need install poetry with recommended way.
If you use Linux, use command:
curl -sSL https://install.python-poetry.org | python -
If you use Windows, open PowerShell with admin privileges and use:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
Installing dependencies
poetry install --no-dev
Configuration
All configuration happens in config.yml, or with enviroment variables.
If something is not clear
You can always write me!
Thanks
This project was generated with python-template.
Release files for apykuma 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apykuma-1.2.0.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apykuma-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / apykuma-1.2.0.tar.gz
| Download URL | apykuma-1.2.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cab6ae75675176d3eca2fa71107ca9c8e6710b2437d721ea2d9fa44e7279de07
|
|
BLAKE2b-256 checksum How to use checksums |
5c72a67584cb8468a742bfc1f26a3663432bad6ab524950fecab534c22cd93b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|
Release files / apykuma-1.2.0-py3-none-any.whl
| Download URL | apykuma-1.2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92728540d5c587ff3844ae682386e995d7b107cdd8840b42de4b99fd6fa90519
|
|
BLAKE2b-256 checksum How to use checksums |
3207554ae1ec7808847a3cc7ccb523ea068b0240901e86c26625e0fd642a9689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|