comparison py/uploader.py @ 292:28eb733cb803

60 second timeout
author Matt Johnston <matt@ucc.asn.au>
date Thu, 19 Mar 2015 21:50:52 +0800
parents 16a83e2c97a0
children d15dda1b1f76
comparison
equal deleted inserted replaced
223:ccf83b5cbbca 292:28eb733cb803
46 def send(self, tosend): 46 def send(self, tosend):
47 js = json.dumps(tosend) 47 js = json.dumps(tosend)
48 js_enc = binascii.b2a_base64(zlib.compress(js)) 48 js_enc = binascii.b2a_base64(zlib.compress(js))
49 mac = hmac.new(config.HMAC_KEY, js_enc).hexdigest() 49 mac = hmac.new(config.HMAC_KEY, js_enc).hexdigest()
50 send_data = {'data': js_enc, 'hmac': mac} 50 send_data = {'data': js_enc, 'hmac': mac}
51 r = requests.post(config.UPDATE_URL, data=send_data) 51 r = requests.post(config.UPDATE_URL, data=send_data, timeout=60)
52 result = r.text 52 result = r.text
53 if result != 'OK': 53 if result != 'OK':
54 raise Exception("Server returned %s" % result) 54 raise Exception("Server returned %s" % result)
55 55
56 def do(self): 56 def do(self):