Refined logs with ChatGPT help

This commit is contained in:
Lyncoln
2026-10-18 00:25:48 -04:00
parent dc04a2bb85
commit 56cbf20339
+6
View File
@@ -14,6 +14,12 @@ def buildLog (action, outputs, response):
if action.showstatus is True and response.ok: if action.showstatus is True and response.ok:
print(f"{action.name} successful") print(f"{action.name} successful")
try:
response_data = response.json()
except ValueError:
response_data = response.text
print(response_data)
elif action.showstatus is True and not response.ok: elif action.showstatus is True and not response.ok:
print(f"{action.name} failed with status code {response.status_code}") print(f"{action.name} failed with status code {response.status_code}")