Thanks, @kchen. The response header is this: x-redlock-status →[{"i18nKey":"internal_error","severity":"error","subject":null}] Your approach is something that I actually implemented as a workaround, but no bueno. The work around looks like this: req_header = {'Content-Type':'application/json','x-redlock-auth':jwt_token}
# This is a small function to get a policy by ID
policy = get_redlock_policy_by_ID(req_header, 'policy_ID')
new_std = {
'standardName': 'standard_name',
'standardDescription': '',
'requirementId': 'req_ID',
'requirementName': 'req_name',
'sectionId': 'section_ID',
'sectionDescription': '',
'policyId': '',
'complianceId': 'compliance_ID',
'systemDefault': False,
'customAssigned': True
}
standards = policy['complianceMetadata']
for standard in standards:
if not 'standard_name' in standard['standardName']:
new_std['policyId'] = policy['policyId']
policy['complianceMetadata'].append(new_std)
try:
response = requests.request('PUT', '{}/policy/{}'.format(REDLOCK_API_URL, policy['policyId']), json=policy, headers=req_header)
if response.status_code == 200:
print('Successful push ---- YA BOI DID IT')
else:
logging.error(' HTTPStatus: ' + str(response.status_code) + ' ' + response.reason)
sys.exit(1)
except requests.exceptions.RequestException as e:
logging.error(' Data Push -- Function: update_redlock_compliance_details: {}'.format(e))
break And it still returns: >> ERROR:root: HTTPStatus: 500 Server Error
... View more