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