send report after errors

Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2023-10-27 15:19:36 +02:00
parent 6159ec68ae
commit 1f3f57e3eb

View File

@@ -86,12 +86,12 @@ class timenetManager:
else:
typ = args.type
response = None
if not args.debug:
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()
data = {
"cp": config['user'],
@@ -107,16 +107,19 @@ class timenetManager:
response = self.post("check", data, self.headers)
else:
self.addMessage('Corriendo en modo debug. No se realizará ninguna acción')
self.sendReport()
exit(20)
if response.text == "no valid worker":
self.addMessage("El trabajador no ha podido ser identificado")
self.sendReport()
exit(20)
try:
rj = json.loads(response.text)
except:
self.addMessage("La respuesta al hacer check no es correcta... algo ha pasado :/")
self.sendReport()
exit(20)
if response.status_code == 200: