Fix access
This commit is contained in:
parent
43110f8d17
commit
d29b5555e3
1 changed files with 5 additions and 5 deletions
10
main.py
10
main.py
|
@ -123,16 +123,16 @@ def application(env, re):
|
|||
yield "device is required.".encode()
|
||||
return
|
||||
|
||||
on = args["on"] if "on" in args else None
|
||||
frm = on if on else args["from"] if "from" in args else None
|
||||
to = on if on else args["to"] if "to" in args else None
|
||||
on = args["on"][0] if "on" in args else None
|
||||
frm = on if on else args["from"][0] if "from" in args else None
|
||||
to = on if on else args["to"][0] if "to" in args else None
|
||||
|
||||
frm = frm or datetime.datetime.now().strftime('%Y-%m-%d')
|
||||
to = to or datetime.datetime.now().strftime('%Y-%m-%d')
|
||||
|
||||
for time in frm, to:
|
||||
try:
|
||||
datetime.strptime(time, "%Y-%m-%d")
|
||||
datetime.datetime.strptime(time, "%Y-%m-%d")
|
||||
except:
|
||||
re("400 Bad Request", [])
|
||||
yield "<h1>400 Bad Request</h1>".encode()
|
||||
|
@ -177,7 +177,7 @@ def application(env, re):
|
|||
"""
|
||||
|
||||
for row in cur.fetchall():
|
||||
output += " [ %s, %s ],\n" % (lat, lon)
|
||||
output += " [ %s, %s ],\n" % (row["lat"], row["lon"])
|
||||
|
||||
output = "".join(output.rsplit(",", 1))
|
||||
|
||||
|
|
Loading…
Reference in a new issue