Separated listener by introducing create listener. Working State. Message loop prevention filters added to server
This commit is contained in:
+13
-6
@@ -9,15 +9,22 @@ def buildLog (action, outputs, response):
|
||||
f"{outputs[print_key]}",
|
||||
)
|
||||
|
||||
except: (KeyError, TypeError)
|
||||
except (KeyError, TypeError):
|
||||
pass
|
||||
|
||||
if action.showstatus is True and response.status_code in [200, 204]:
|
||||
if action.showstatus is True and response.ok:
|
||||
print(f"{action.name} successful")
|
||||
|
||||
elif action.showstatus is True and response.status_code not in [200, 204]:
|
||||
elif action.showstatus is True and not response.ok:
|
||||
print(f"{action.name} failed with status code {response.status_code}")
|
||||
|
||||
try:
|
||||
print(f"Response: {response.json()["error"]}")
|
||||
except KeyError:
|
||||
print(f"Response:", response.json())
|
||||
response_data = response.json()
|
||||
except ValueError:
|
||||
response_data = response.text
|
||||
|
||||
if isinstance(response_data, dict):
|
||||
print("Response:", response_data.get("error", response_data))
|
||||
else:
|
||||
print("Response:", response_data)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user