Skip to content

Commit

Permalink
updated weather widget to new location API,
Browse files Browse the repository at this point in the history
  • Loading branch information
toottRenat committed Aug 5, 2018
1 parent c9569c2 commit 0e331e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion smartmirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<KEY>' # create account at https://ipstack.com/
weather_api_token = '<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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 0e331e0

Please sign in to comment.