A wrapper for the Uptime Kuma Socket.IO API
Find a file
2022-08-26 17:07:55 +02:00
scripts fix delete tag test and fix compare object 2022-08-03 16:56:38 +02:00
tests rename 2FA token 2022-08-26 17:02:55 +02:00
uptime_kuma_api rename 2FA token 2022-08-26 17:02:55 +02:00
.coveragerc add tests 2022-08-02 23:47:56 +02:00
.gitignore prepare pypi release and fix add monitor 2022-07-07 22:17:47 +02:00
LICENSE add license 2022-08-02 21:33:03 +02:00
README.md Update README.md 2022-08-04 20:17:04 +02:00
requirements.txt adjust python-socketio client depencency 2022-08-02 11:33:54 +02:00
setup.py include readme as long_description in setup.py 2022-08-03 23:29:11 +02:00

uptime-kuma-api

A wrapper for the Uptime Kuma Socket.IO API

uptime-kuma-api is a Python wrapper for the Uptime Kuma Socket.IO API.

This package was developed to configure Uptime Kuma with Ansible. The Ansible collection can be found at https://github.com/lucasheld/ansible-uptime-kuma.

Python version 3.6+ is required.

Installation

uptime-kuma-api is available on the Python Package Index (PyPI).

You can install it using pip:

pip install uptime-kuma-api

Examples

Once you have installed the python package, you can use it to communicate with an Uptime Kuma instance.

To do so, import UptimeKumaApi from the library and specify the Uptime Kuma server url (e.g. 'http://127.0.0.1:3001'), username and password to initialize the connection.

>>> from uptime_kuma_api import UptimeKumaApi, MonitorType
>>> api = UptimeKumaApi('INSERT_URL')
>>> api.login('INSERT_USERNAME', 'INSERT_PASSWORD')

Now you can call one of the existing methods of the instance. For example create a new monitor:

>>> result = api.add_monitor(type=MonitorType.HTTP, name="Google", url="https://google.com")
>>> print(result)
{'msg': 'Added Successfully.', 'monitorId': 1}

At the end, the connection to the API must be disconnected so that the program does not block.

>>> api.disconnect()