summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2021-05-15 19:35:50 +0300
committerYuval Adam <_@yuv.al>2021-05-15 19:35:50 +0300
commit77fd0ca159e391ed165b038d81a324301bb36247 (patch)
tree4a1bd1c2acc890377588109dcf4d93f9bd39d025
parent9b538a97957ab0aea96288961f8fcdef510b30f6 (diff)
Add geolocation limit error message
-rw-r--r--alarmpy/alarmpy.py5
1 files changed, 5 insertions, 0 deletions
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