Update README.md

This commit is contained in:
lucasheld 2022-08-04 20:16:51 +02:00
parent cd1af9194e
commit 821f68a061

View file

@ -22,10 +22,10 @@ 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.
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.
```python
>>> from uptime_kuma_api import UptimeKumaApi
>>> from uptime_kuma_api import UptimeKumaApi, MonitorType
>>> api = UptimeKumaApi('INSERT_URL')
>>> api.login('INSERT_USERNAME', 'INSERT_PASSWORD')
```
@ -33,7 +33,13 @@ To do so, import `UptimeKumaApi` from the library and specify the Uptime Kuma se
Now you can call one of the existing methods of the instance. For example create a new monitor:
```python
>>> result = api.add_monitor(type=MonitorType.HTTP, name="new monitor", url="http://192.168.1.1")
>>> 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.
```python
>>> api.disconnect()
```