🐛 (api.py): Raise correct error when timeout
This commit is contained in:
parent
be97a4fd8f
commit
677de72b2b
1 changed files with 4 additions and 1 deletions
|
@ -500,7 +500,10 @@ class UptimeKumaApi(object):
|
||||||
return deepcopy(self._event_data[event].copy())
|
return deepcopy(self._event_data[event].copy())
|
||||||
|
|
||||||
def _call(self, event, data=None) -> Any:
|
def _call(self, event, data=None) -> Any:
|
||||||
|
try:
|
||||||
r = self.sio.call(event, data, timeout=self.timeout)
|
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 isinstance(r, dict) and "ok" in r:
|
||||||
if not r["ok"]:
|
if not r["ok"]:
|
||||||
raise UptimeKumaException(r.get("msg"))
|
raise UptimeKumaException(r.get("msg"))
|
||||||
|
|
Loading…
Reference in a new issue