From 3e0ba04aeadf3682c81a6df3f76f72f4d919069b Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Fri, 21 Sep 2018 00:09:40 -0400 Subject: [PATCH] Gracefully handle missing IPSTACK_ACCESS_KEY setting. Fixes #118 --- events/ipstack.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/events/ipstack.py b/events/ipstack.py index 90c6163..553356b 100644 --- a/events/ipstack.py +++ b/events/ipstack.py @@ -101,7 +101,8 @@ def get_ipstack_geocoder(ip): return RESULT_CACHE[ip] ipstack_key = getattr(settings, 'IPSTACK_ACCESS_KEY', None) if ipstack_key is None: - raise Exception("You must define IPSTACK_ACCESS_KEY in your setting to use ipstack.py geocoding") + print("You must define IPSTACK_ACCESS_KEY in your setting to use ipstack.com geocoding") + return IPStackResult({}) call_url = IPSTACK_URL.format(ip, ipstack_key) session = requests.Session()