diff --git a/main.py b/main.py index 59a8449..6621fba 100644 --- a/main.py +++ b/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 "

400 Bad Request

".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))