iptime: update to match astral 2.2

master
Michael Hope 2 years ago
parent 8573ab58c1
commit a08ad836c2

@ -4,6 +4,7 @@ import time
from geoip import geolite2
import astral
import astral.sun
import dateutil.tz
import flask
import requests
@ -40,8 +41,9 @@ def now():
tz = dateutil.tz.gettz(loc.timezone)
epoch = time.time()
now = datetime.datetime.now(tz)
sun = astral.Location((loc.ip, loc.country, loc.location[0],
loc.location[1], loc.timezone, 0)).sun()
city = astral.LocationInfo((loc.ip, loc.country, loc.location[0],
loc.location[1], loc.timezone, 0))
sun = astral.sun.sun(city.observer, date=now)
dawn = sun['dawn']
dusk = sun['dusk']

Loading…
Cancel
Save