iptime: fix the pyflake8 errors

master
Michael Hope 3 years ago
parent 721c9fe70b
commit 52a984c726

@ -1,5 +1,4 @@
import datetime
import sys
import time
from geoip import geolite2
@ -32,23 +31,21 @@ def now():
tz = dateutil.tz.gettz(loc.timezone)
epoch = time.time()
now = datetime.datetime.now(tz)
l = astral.Location((loc.ip, loc.country, loc.location[0], loc.location[1],
loc.timezone, 0))
s = l.sun()
dawn = s['dawn']
dusk = s['dusk']
sun = astral.Location((loc.ip, loc.country, loc.location[0],
loc.location[1], loc.timezone, 0)).sun()
dawn = sun['dawn']
dusk = sun['dusk']
resp = dict(
ip=loc.ip,
country=loc.country,
latitude=loc.location[0],
longitude=loc.location[1],
timezone=loc.timezone,
dawn=dawn,
dawn_sec=to_sec(dawn),
dusk=dusk,
dusk_sec=to_sec(dusk),
local_time=now,
day_sec=to_sec(now),
posix_sec=int(epoch))
resp = dict(ip=loc.ip,
country=loc.country,
latitude=loc.location[0],
longitude=loc.location[1],
timezone=loc.timezone,
dawn=dawn,
dawn_sec=to_sec(dawn),
dusk=dusk,
dusk_sec=to_sec(dusk),
local_time=now,
day_sec=to_sec(now),
posix_sec=int(epoch))
return flask.jsonify(resp)

Loading…
Cancel
Save