From 677de72b2bb12b300ee9d9175009bcc2e2767734 Mon Sep 17 00:00:00 2001 From: Raphael Hien Date: Thu, 10 Aug 2023 11:45:23 +0200 Subject: [PATCH] :bug: (api.py): Raise correct error when timeout --- uptime_kuma_api/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uptime_kuma_api/api.py b/uptime_kuma_api/api.py index 9912dd3..9d79f4e 100644 --- a/uptime_kuma_api/api.py +++ b/uptime_kuma_api/api.py @@ -500,7 +500,10 @@ 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"))