diff --git a/pi/monitor.py b/pi/monitor.py index f4bc016..0bfe090 100644 --- a/pi/monitor.py +++ b/pi/monitor.py @@ -51,15 +51,22 @@ print "status now: " + str(status) try: - response = urllib2.urlopen(baseUrl + "/status-update" + ext + ".php?door_id=" + str(id) + "&status=" + ("1" if status else "0")) + url = url_base + "status-update" + ext + "?door_id=" + str(id) + "&status=" + ("1" if status else "0") + print " open " + url + response = urllib2.urlopen(url) enc_verify = base64.b64decode(response.read()) verify = rsa.decrypt(enc_verify) + if ext == "": + verify = base64.b64encode(verify) + print " verifying with: " + verify - response = urllib2.urlopen(baseUrl + "/verify-status" + ext + ".php?door_id=" + str(id) + "&verify=" + verify) + url = url_base + "verify-status" + ext + "?door_id=" + str(id) + "&verify=" + verify + print " open " + url + response = urllib2.urlopen(url) print " returned: " + response.read() except Exception as e: print str(e)