This commit is contained in:
Raphaël "Zerka" H 2023-09-26 19:58:18 -03:00 committed by GitHub
commit ecc81f2dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -544,13 +544,16 @@ class UptimeKumaApi(object):
return deepcopy(self._event_data[event].copy())
def _call(self, event, data=None) -> Any:
r = self.sio.call(event, data, timeout=self.timeout)
try:
r = self.sio.call(event, data, timeout=self.timeout)
except socketio.exceptions.TimeoutError:
raise Timeout(f"Timed out while waiting for event {event}")
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: