[digicode] La chaine digicode doit être un entier
On vérifie que le digicode n'envoie pas une chaîne de caractère non castable en entier. Causait des plantages à cause du caractère '*'.
This commit is contained in:
parent
e867dfe221
commit
eb4f22fd61
1 changed files with 7 additions and 3 deletions
|
@ -47,9 +47,13 @@ class VigileHandler(SocketServer.BaseRequestHandler):
|
||||||
# if data starts with o, opened door validation, else should
|
# if data starts with o, opened door validation, else should
|
||||||
# be a code
|
# be a code
|
||||||
if not data.startswith("o"):
|
if not data.startswith("o"):
|
||||||
|
try:
|
||||||
|
int(data)
|
||||||
response = requests.post(DIGICODE_LINK, data = {'password' : digicode_pass, 'code' : data}, verify = CERTIFICATE, timeout=0.5)
|
response = requests.post(DIGICODE_LINK, data = {'password' : digicode_pass, 'code' : data}, verify = CERTIFICATE, timeout=0.5)
|
||||||
if response.content == u'Code Successfully Deleted':
|
if response.content == u'Code Successfully Deleted':
|
||||||
socket.sendto("passoir,o=1", self.client_address)
|
socket.sendto("passoir,o=1", self.client_address)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
log("%s -- %s" % (data, response.content))
|
log("%s -- %s" % (data, response.content))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue