From a4d0126a148f1d6024ebb82b032c7844f87fb5b9 Mon Sep 17 00:00:00 2001 From: fly Date: Thu, 4 Mar 2021 14:21:32 +0000 Subject: [PATCH] Fixed not sending the status Signed-off-by: fly --- common.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common.py b/common.py index fc0c209..ff15d65 100644 --- a/common.py +++ b/common.py @@ -116,18 +116,18 @@ def send_status(name, status, host, port): sys.exit(1) # Sends status to the manager api -def api_send_status(name, status, api, api_token): +def api_send_status(name, status, api, token): try: success = False while not success: - response = requests.post(api, data={'auth': token, 'action': 'set', 'tile': name}, headers={"lAccept": "application/json", "Content-Type": "application/x-www-form-urlencoded"}) + response = requests.post(api, data={'auth': token, 'action': 'set', 'tile': name, 'status': status}, headers={"lAccept": "application/json", "Content-Type": "application/x-www-form-urlencoded"}) success = response.json()["success"] if not success: print("Warning: Unable to send status " + status + " for tile " + name + ". Trying again in 60 seconds") sleep(60) except IOError: - print("Unable to send status " + status + " for tile " + name + ". Aborting...") - sys.exit(1) + print("Warning: Unable to send status " + status + " for tile " + name + ". Trying again in 60 seconds") + sleep(60) # Gets new job from manager def get_job(action, host, port, none_exit=True): @@ -159,7 +159,7 @@ def get_job(action, host, port, none_exit=True): def api_get_job(action, api, token, none_exit=True): try: response = requests.post(api, data={'auth': token, 'action': 'get-job', 'additional-type': action}, headers={"lAccept": "application/json", "Content-Type": "application/x-www-form-urlencoded"}) - match = re.match(r"[ew]\d{3}[ns]\d{2}|[0-9]{1,7}|None", responce.json()["job"]) + match = re.match(r"[ew]\d{3}[ns]\d{2}|[0-9]{1,7}|None", str(response.json()["job"])) if match != None: ret = match.group(0) if ret == "None" and none_exit: