🐛 (api.py): Fix to work has expected

This commit is contained in:
Raphaël "Zerka" H 2023-08-31 12:14:41 +02:00 committed by GitHub
parent 91ad893223
commit d56ffcc774
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -502,14 +502,14 @@ class UptimeKumaApi(object):
def _call(self, event, data=None) -> Any: def _call(self, event, data=None) -> Any:
try: try:
r = self.sio.call(event, data, timeout=self.timeout) r = self.sio.call(event, data, timeout=self.timeout)
r.pop("ok")
except socketio.exceptions.TimeoutError: except socketio.exceptions.TimeoutError:
raise Timeout(f"Timed out while waiting for event {event}") raise Timeout(f"Timed out while waiting for event {event}")
except Exception as e: if isinstance(r, dict) and "ok" in r:
raise UptimeKumaException(r.get("msg")) if not r["ok"]:
raise UptimeKumaException(r.get("msg"))
r.pop("ok")
return r return r
# event handlers # event handlers
def _event_connect(self) -> None: def _event_connect(self) -> None: