in cloudformation/resource_tools.py [0:0]
def send(event, context, response_status, response_data, physical_resource_id):
response_url = event['ResponseURL']
response_body = {
'Status': response_status,
'Reason': 'See the details in CloudWatch Log Stream: ' + context.log_stream_name,
'PhysicalResourceId': physical_resource_id or context.log_stream_name,
'StackId': event['StackId'],
'RequestId': event['RequestId'],
'LogicalResourceId': event['LogicalResourceId'],
'Data': response_data
}
json_response_body = json.dumps(response_body)
print("Response body:\n" + json_response_body)
headers = {'content-type': '', 'content-length': str(len(json_response_body))}
try:
response = requests.put(response_url, data=json_response_body, headers=headers)
print("Status code: " + response.reason)
except Exception as e:
print("EXCEPTION {}".format(e))
return