23 lines
774 B
Python
23 lines
774 B
Python
import logging
|
|
|
|
from core.apirequest import executeRequest
|
|
|
|
def responsePolicy(response, action, outputs, resolved):
|
|
if hasattr(action, "responsepolicy"):
|
|
if not response.ok:
|
|
logging.warning(f"{response} during {action.name}")
|
|
|
|
for policy in action.responsepolicy:
|
|
if policy["statuscode"] == response.status_code:
|
|
logging.warning(policy["print"])
|
|
|
|
newresponse, outputs = executeRequest(policy["execute"], outputs, resolved)
|
|
|
|
if policy["response_update"]:
|
|
logging.info("Updating response")
|
|
print("Updating response")
|
|
response = newresponse
|
|
|
|
break
|
|
|
|
return response |