Compare commits

...

2 commits

Author SHA1 Message Date
Raphaël "Zerka" H
d56ffcc774
🐛 (api.py): Fix to work has expected 2023-08-31 12:14:41 +02:00
Zerka30
91ad893223
🐛 (api.py): Raise correct error when timeout 2023-08-10 12:18:47 +02:00

View file

@ -500,13 +500,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: