Mercurial > templog
changeset 536:3a27b1a09d2e
sha256 hash
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 19 May 2015 23:58:51 +0800 |
parents | 3a514fbb88eb |
children | 92632a6d1dc6 b0b0c7e7133c |
files | py/uploader.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/py/uploader.py Tue May 19 15:07:57 2015 +0000 +++ b/py/uploader.py Tue May 19 23:58:51 2015 +0800 @@ -48,9 +48,9 @@ if self.server.test_mode(): D("Would upload %s to %s" % (js, config.UPDATE_URL)) return - js_enc = binascii.b2a_base64(zlib.compress(js.encode())) - mac = hmac.new(config.HMAC_KEY.encode(), js_enc, hashlib.sha1).hexdigest() - send_data = {'data': js_enc, 'hmac': mac} + js_enc = binascii.b2a_base64(zlib.compress(js.encode())).strip() + mac = hmac.new(config.HMAC_KEY.encode(), js_enc, hashlib.sha256).hexdigest() + send_data = {'data': js_enc.decode(), 'hmac': mac} r = yield from asyncio.wait_for(aiohttp.request('post', config.UPDATE_URL, data=send_data), 60) result = yield from asyncio.wait_for(r.text(), 60) if result != 'OK':