Mercurial > templog
changeset 38:f9a7e872c868
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 16 Jun 2012 09:08:40 +0800 |
parents | a670a67ba489 (current diff) 4bfa9b7b2e4b (diff) |
children | 9a3b967a920c |
files | |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
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':