Update README.md

This commit is contained in:
Lucas Held 2023-05-02 20:43:52 +02:00 committed by GitHub
parent 7ef61f8ce1
commit a576ed9f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ Documentation
--- ---
The API Reference is available on [Read the Docs](https://uptime-kuma-api.readthedocs.io). The API Reference is available on [Read the Docs](https://uptime-kuma-api.readthedocs.io).
Examples Example
--- ---
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.
@ -49,3 +49,17 @@ At the end, the connection to the API must be disconnected so that the program d
```python ```python
>>> api.disconnect() >>> api.disconnect()
``` ```
With a context manager, the disconnect method is called automatically:
```python
from uptime_kuma_api import UptimeKumaApi
with UptimeKumaApi('INSERT_URL') as api:
api.login('INSERT_USERNAME', 'INSERT_PASSWORD')
api.add_monitor(
type=MonitorType.HTTP,
name="Google",
url="https://google.com"
)
```