Fixed merge conflict

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-04-20 10:12:40 +02:00
parent f113d3e779
commit 7ab046aa94

View file

@ -20,6 +20,7 @@ import sys
import socket
import re
import requests
import json
from time import sleep
# Adds leading 0s
@ -137,7 +138,7 @@ def api_send_status(name, status, api, token):
else:
print("Warning: Unable to send status '" + status + "' for tile '" + name + "'. Trying again in 60 seconds")
sleep(60)
except (ConnectionError, OSError, IOError):
except (ConnectionError, OSError, IOError, json.decoder.JSONDecodeError):
print("Warning: Unable to send status " + status + " for tile " + name + ". Trying again in 60 seconds")
sleep(60)
@ -172,7 +173,7 @@ def api_get_job(action, new_status, api, token, none_exit=True):
try:
response = requests.post(api, data={'auth': token, 'action': 'get-job', 'status': action, 'new-status': new_status}, headers={"lAccept": "application/json", "Content-Type": "application/x-www-form-urlencoded"})
if response.ok and response.json()["success"] == True:
match = re.match(r"[ew]\d{3}[ns]\d{2}|[0-9]{1,7}|None", str(response.json()["job"]))
match = re.match(r"[0-9]{1,7}|None", str(response.json()["job"]))
if match != None:
ret = match.group(0)
if ret == "None" and none_exit:
@ -188,7 +189,7 @@ def api_get_job(action, new_status, api, token, none_exit=True):
sleep(60)
ret = api_get_job(action, new_status, api, token, none_exit)
return ret
except (ConnectionError, OSError, IOError):
except (ConnectionError, OSError, IOError, json.decoder.JSONDecodeError):
print("Unable to get job. Retrying in 60 seconds...")
sleep(60)
ret = api_get_job(action, new_status, api, token, none_exit)
@ -231,6 +232,6 @@ def api_get_status(name, api, api_token):
else:
print("ERROR: Unable to get status.")
sys.exit(1)
except (ConnectionError, OSError, IOError):
except (ConnectionError, OSError, IOError, json.decoder.JSONDecodeError):
print("ERROR: Unable to get status.")
sys.exit(1)