feat: implement get_monitor_status
helper method
This commit is contained in:
parent
b87eed2597
commit
a9f2b6d894
1 changed files with 10 additions and 0 deletions
|
@ -3560,3 +3560,13 @@ class UptimeKumaApi(object):
|
||||||
"""
|
"""
|
||||||
with self.wait_for_event(Event.API_KEY_LIST):
|
with self.wait_for_event(Event.API_KEY_LIST):
|
||||||
return self._call('deleteAPIKey', id_)
|
return self._call('deleteAPIKey', id_)
|
||||||
|
|
||||||
|
# helper methods
|
||||||
|
|
||||||
|
def get_monitor_status(self, monitor_id: int) -> MonitorStatus:
|
||||||
|
heartbeats = self.get_heartbeats()
|
||||||
|
for heartbeat in heartbeats:
|
||||||
|
if int(heartbeat["id"]) == monitor_id:
|
||||||
|
status = heartbeat["data"][-1]["status"]
|
||||||
|
return MonitorStatus(status)
|
||||||
|
raise UptimeKumaException("monitor does not exist")
|
||||||
|
|
Loading…
Reference in a new issue