From 0e331e08bf59c346415a51dc2a2cab0a326c903f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B5=D0=BD=D0=B0=D1=82?= Date: Sun, 5 Aug 2018 16:46:02 +0300 Subject: [PATCH] updated weather widget to new location API, Fixes #108 --- smartmirror.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smartmirror.py b/smartmirror.py index 3d938b77..b50ed284 100644 --- a/smartmirror.py +++ b/smartmirror.py @@ -20,6 +20,7 @@ time_format = 12 # 12 or 24 date_format = "%b %d, %Y" # check python doc for strftime() for options news_country_code = 'us' +ip_stack_key = '' # create account at https://ipstack.com/ weather_api_token = '' # create account at https://darksky.net/dev/ weather_lang = 'en' # see https://darksky.net/dev/docs/forecast for full list of language parameters values weather_unit = 'us' # see https://darksky.net/dev/docs/forecast for full list of unit parameters values @@ -137,7 +138,8 @@ def get_weather(self): if latitude is None and longitude is None: # get location - location_req_url = "http://freegeoip.net/json/%s" % self.get_ip() + location_req_url = 'http://api.ipstack.com/%s?access_key=%s&output=json&legacy=1' % (self.get_ip(), + ip_stack_key) r = requests.get(location_req_url) location_obj = json.loads(r.text)