Fix referenced before assignment issue
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
dfae55128e
commit
e0bf908b25
1 changed files with 3 additions and 1 deletions
|
@ -170,6 +170,7 @@ def get_job(action, host, port, none_exit=True):
|
||||||
|
|
||||||
# Gets new job from manager api
|
# Gets new job from manager api
|
||||||
def api_get_job(action, new_status, api, token, level, none_exit=True, all_in_parent=0):
|
def api_get_job(action, new_status, api, token, level, none_exit=True, all_in_parent=0):
|
||||||
|
response = None
|
||||||
try:
|
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"})
|
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:
|
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:
|
else:
|
||||||
return None
|
return None
|
||||||
except (ConnectionError, OSError, IOError, json.JSONDecodeError):
|
except (ConnectionError, OSError, IOError, json.JSONDecodeError):
|
||||||
|
if response != None:
|
||||||
print(response.text)
|
print(response.text)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue