diff web/index.py @ 31:5e75e08d20ac

- Various fixes for web server, kind of works
author Matt Johnston <matt@ucc.asn.au>
date Wed, 13 Jun 2012 23:41:05 +0800
parents 13fcf497f8b7
children
line wrap: on
line diff
--- a/web/index.py	Tue Jun 12 23:43:49 2012 +0800
+++ b/web/index.py	Wed Jun 13 23:41:05 2012 +0800
@@ -3,9 +3,11 @@
 import binascii
 import hmac
 import zlib
+import datetime
+import time
 
 import bottle
-from bottle import route, request
+from bottle import route, request, response
 
 import config
 import log
@@ -26,14 +28,13 @@
 
 @route('/graph.png')
 def graph():
-    start_secs = int(request.query.start)
     # url takes time in hours or days
     if 'day' in request.query:
-        start_day = datetime.strptime(request.query.day, '%Y%m%d')
+        start_day = datetime.datetime.strptime(request.query.day, '%Y%m%d')
         start = time.mktime(start_day.timetuple())
         length = int(request.query.length) * 3600 * 24
     else:
-        start_hour = datetime.strptime(request.query.hour, '%Y%m%d%H')
+        start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H')
         start = time.mktime(start_hour.timetuple())
         length = int(request.query.length) * 3600