From 77fd0ca159e391ed165b038d81a324301bb36247 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Sat, 15 May 2021 19:35:50 +0300 Subject: Add geolocation limit error message --- alarmpy/alarmpy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/alarmpy/alarmpy.py b/alarmpy/alarmpy.py index 8c56647..3d81559 100644 --- a/alarmpy/alarmpy.py +++ b/alarmpy/alarmpy.py @@ -60,6 +60,11 @@ class Alarm: def fetch(self): try: res = self.session.get(self.URL, headers=self.HEADERS, timeout=1) + if not res.ok and "Access Denied" in res.text: + self.output_error( + "API endpoint has denied access. This might be due to geolocation limitations, please try running from an Israeli-based IP or proxy." + ) + exit(1) except requests.Timeout as e: raise Exception("HTTP request timed out") from e -- cgit v1.3.1