Mercurial > templog
diff server/ts.py @ 334:3b821541657d
hmac
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 12 Jun 2012 00:35:23 +0800 |
parents | 298e502fdcd4 |
children | 048143905092 |
line wrap: on
line diff
--- a/server/ts.py Tue Jun 12 00:09:09 2012 +0800 +++ b/server/ts.py Tue Jun 12 00:35:23 2012 +0800 @@ -16,6 +16,10 @@ import httplib import time import traceback +import binascii +import hmac + +import config from utils import monotonic_time, retry, readline, crc16 @@ -105,6 +109,14 @@ return int(next_wake) +def send_results(lines): + enc_lines = binascii.b2a_base64('\n'.join(lines)) + hmac.new(config.HMAC_KEY, enc_lines).hexdigest() + + url_data = urllib.url_encode( ('lines', enc_lines), ('hmac', mac) ) + con = urllib2.urlopen(config.UPDATE_URL, url_data) + + def do_comms(sock): print "do_comms" d = None