Fix referenced before assignment issue

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2023-05-15 19:00:31 +00:00
parent dfae55128e
commit e0bf908b25

View file

@ -170,6 +170,7 @@ def get_job(action, host, port, none_exit=True):
# Gets new job from manager api
def api_get_job(action, new_status, api, token, level, none_exit=True, all_in_parent=0):
response = None
try:
response = requests.post(api, data={'auth': token, 'action': 'get-job', 'status': action, 'new-status': new_status, "all-in-parent": all_in_parent, "level": level}, headers={"lAccept": "application/json", "Content-Type": "application/x-www-form-urlencoded"})
if response.ok and response.json()["success"] == True:
@ -184,6 +185,7 @@ def api_get_job(action, new_status, api, token, level, none_exit=True, all_in_pa
else:
return None
except (ConnectionError, OSError, IOError, json.JSONDecodeError):
if response != None:
print(response.text)
return None