Update README.md
This commit is contained in:
parent
cd1af9194e
commit
821f68a061
1 changed files with 9 additions and 3 deletions
12
README.md
12
README.md
|
@ -22,10 +22,10 @@ Examples
|
||||||
---
|
---
|
||||||
Once you have installed the python package, you can use it to communicate with an Uptime Kuma instance.
|
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
|
```python
|
||||||
>>> from uptime_kuma_api import UptimeKumaApi
|
>>> from uptime_kuma_api import UptimeKumaApi, MonitorType
|
||||||
>>> api = UptimeKumaApi('INSERT_URL')
|
>>> api = UptimeKumaApi('INSERT_URL')
|
||||||
>>> api.login('INSERT_USERNAME', 'INSERT_PASSWORD')
|
>>> 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:
|
Now you can call one of the existing methods of the instance. For example create a new monitor:
|
||||||
|
|
||||||
```python
|
```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)
|
>>> print(result)
|
||||||
{'msg': 'Added Successfully.', 'monitorId': 1}
|
{'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()
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue