From 1f3f57e3ebffc0c0f19f3e3a6439e43ec8343808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20S=C3=A1nchez=20Pizarro?= Date: Fri, 27 Oct 2023 15:19:36 +0200 Subject: [PATCH] send report after errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Omar Sánchez Pizarro --- app/timenet_manager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/timenet_manager.py b/app/timenet_manager.py index c4aaef6..8447454 100644 --- a/app/timenet_manager.py +++ b/app/timenet_manager.py @@ -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: