2022-07-10 21:57:22 +02:00
# uptime-kuma-api
2022-08-03 22:19:37 +02:00
A wrapper for the Uptime Kuma Socket.IO API
2022-07-10 21:57:22 +02:00
---
2022-08-03 22:19:37 +02:00
uptime-kuma-api is a Python wrapper for the Uptime Kuma Socket.IO API.
2022-07-10 21:57:22 +02:00
2022-07-10 22:54:04 +02:00
This package was developed to configure Uptime Kuma with Ansible. The Ansible collection can be found at https://github.com/lucasheld/ansible-uptime-kuma.
2022-08-03 11:56:02 +02:00
Python version 3.6+ is required.
2022-07-10 21:57:22 +02:00
Installation
---
uptime-kuma-api is available on the Python Package Index (PyPI).
You can install it using pip:
```
2022-08-03 22:19:37 +02:00
pip install uptime-kuma-api
2022-07-10 21:57:22 +02:00
```
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, username and password to initialize the connection.
```python
2022-07-10 21:58:42 +02:00
>>> from uptime_kuma_api import UptimeKumaApi
>>> api = UptimeKumaApi('INSERT_URL')
>>> api.login('INSERT_USERNAME', 'INSERT_PASSWORD')
2022-07-10 21:57:22 +02:00
```
Now you can call one of the existing methods of the instance. For example create a new monitor:
```python
2022-08-03 11:56:02 +02:00
>>> result = api.add_monitor(type=MonitorType.HTTP, name="new monitor", url="http://192.168.1.1")
2022-07-10 21:57:22 +02:00
>>> print(result)
2022-08-03 11:56:02 +02:00
{'msg': 'Added Successfully.', 'monitorId': 1}
2022-07-10 21:57:22 +02:00
```