send report after errors
Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
@@ -86,12 +86,12 @@ class timenetManager:
|
|||||||
else:
|
else:
|
||||||
typ = args.type
|
typ = args.type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
response = None
|
response = None
|
||||||
if not args.debug:
|
if not args.debug:
|
||||||
self.addMessage("####HACIENDO CHECK####")
|
self.addMessage("####HACIENDO CHECK####")
|
||||||
sleep(random.randint(0, 230))
|
rand = random.randint(0, 230);
|
||||||
|
sleep(rand)
|
||||||
|
self.addMessage("Esperando %s segundos para fichar/desfichar en un minuto aleatorio" % rand)
|
||||||
self.updateTime()
|
self.updateTime()
|
||||||
data = {
|
data = {
|
||||||
"cp": config['user'],
|
"cp": config['user'],
|
||||||
@@ -107,16 +107,19 @@ class timenetManager:
|
|||||||
response = self.post("check", data, self.headers)
|
response = self.post("check", data, self.headers)
|
||||||
else:
|
else:
|
||||||
self.addMessage('Corriendo en modo debug. No se realizará ninguna acción')
|
self.addMessage('Corriendo en modo debug. No se realizará ninguna acción')
|
||||||
|
self.sendReport()
|
||||||
exit(20)
|
exit(20)
|
||||||
|
|
||||||
if response.text == "no valid worker":
|
if response.text == "no valid worker":
|
||||||
self.addMessage("El trabajador no ha podido ser identificado")
|
self.addMessage("El trabajador no ha podido ser identificado")
|
||||||
|
self.sendReport()
|
||||||
exit(20)
|
exit(20)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rj = json.loads(response.text)
|
rj = json.loads(response.text)
|
||||||
except:
|
except:
|
||||||
self.addMessage("La respuesta al hacer check no es correcta... algo ha pasado :/")
|
self.addMessage("La respuesta al hacer check no es correcta... algo ha pasado :/")
|
||||||
|
self.sendReport()
|
||||||
exit(20)
|
exit(20)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user