Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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