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)