def invoke_endpoint()

in source/notebooks/src/package/generate_endpoint_traffic.py [0:0]


def invoke_endpoint(payload):
    """
    We get credentials from the IAM role of the notebook instance,
    then use them to create a signed request to the API Gateway
    """
    auth = BotoAWSRequestsAuth(aws_host="{}.execute-api.{}.amazonaws.com".format(
                                 config.REST_API_GATEWAY, config.AWS_REGION),
                               aws_region=config.AWS_REGION,
                               aws_service='execute-api')

    invoke_url = "https://{}.execute-api.{}.amazonaws.com/prod/invocations".format(
        config.REST_API_GATEWAY, config.AWS_REGION)

    requests.post(invoke_url, json=payload, auth=auth)