def send()

in functions/source/integration-test/cfnresponse.py [0:0]


def send(event, context, responseStatus, responseData, physicalResourceId):
    responseUrl = event['ResponseURL']

    print responseUrl

    responseBody = {}
    responseBody['Status'] = responseStatus
    responseBody['Reason'] = 'See the details in CloudWatch Log Stream: ' + context.log_stream_name
    responseBody['PhysicalResourceId'] = physicalResourceId or context.log_stream_name
    responseBody['StackId'] = event['StackId']
    responseBody['RequestId'] = event['RequestId']
    responseBody['LogicalResourceId'] = event['LogicalResourceId']
    responseBody['Data'] = responseData

    json_responseBody = json.dumps(responseBody)
    

    print "Response body:\n" + json_responseBody

    headers = {
        'content-type': '',
        'content-length': str(len(json_responseBody))
    }

    code =""

    try:
        # As this is a SaaS integration connectivity and message are all that are tested
        # Any other APIs are black boxed and not exposed to customer or third parties
        response = requests.get(responseUrl)
        code = response.status_code
        print "Status code: " + response.status_code
    except Exception as e:
        print "send(..) failed executing requests.get(..): " + str(e) + "SC:" + code