api.delete_monitor() does nothing #35
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DGNum/uptime-kuma-api#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
api.delete_monitor(id) reports {'msg': 'Deleted Successfully.'} with valid (or invalid) ID, but does nothing.
(add_monitor works fine, so it is not an issue with the installation, kuma instance, login creds, etc.)
Kuma 1.21.3
API 0.13.0
Python 3.8.13
myuser@MyServer:/home/MyPath/kuma# ./kapi-add.py
{'msg': 'Added Successfully.', 'monitorID': 13}
myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13
{'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', .......
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-del.py 13345345345314531453145134531245
{'msg': 'Deleted Successfully.'}
myuser@MyServer:/home/MyPath/kuma# ./kapi-get.py 13
{'id': 13, 'name': 'newmonitor', 'description': None, 'url': 'HTTPS://newmon.domain.com', 'method': 'GET', ............
That is strange. I can reproduce the behavior. But the problem cannot be caused by this Python module. The code for deleting a monitor is the same as for deleting a proxy. When deleting a non-existing proxy, Uptime Kuma sends an error message and for monitors it does not.
I should probably check if the item even exists before deleting it and not rely on the error message from Uptime Kuma.
Edit:
To be clear: The deletion itself works. Just the return value is not correct.
It's included in release 1.0.1