diff server/ts.py @ 343:aa247177837a

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 16 Jun 2012 09:08:40 +0800
parents ba9bfcc9c526
children 9b5b202129c3
line wrap: on
line diff
--- a/server/ts.py	Sat Jun 16 09:07:38 2012 +0800
+++ b/server/ts.py	Sat Jun 16 09:08:40 2012 +0800
@@ -19,6 +19,8 @@
 import binascii
 import hmac
 import zlib
+import urllib
+import urllib2
 
 import config
 
@@ -57,7 +59,6 @@
         print>>sys.stderr, "Bad expected START line '%s'\n" % l.rstrip('\n')
         return None
     crc = crc16(l, crc)
-    lines.append(l)
 
     while True:
         l = readline(sock)
@@ -122,9 +123,9 @@
 
 def send_results(lines):
     enc_lines = binascii.b2a_base64(zlib.compress('\n'.join(lines)))
-    hmac.new(config.HMAC_KEY, enc_lines).hexdigest()
+    mac = hmac.new(config.HMAC_KEY, enc_lines).hexdigest()
 
-    url_data = urllib.url_encode( ('lines', enc_lines), ('hmac', mac) )
+    url_data = urllib.urlencode( {'lines': enc_lines, 'hmac': mac} )
     con = urllib2.urlopen(config.UPDATE_URL, url_data)
     result = con.read(100)
     if result == 'OK':