def _python36_extractor()

in codeguru_profiler_agent/aws_lambda/lambda_handler.py [0:0]


def _python36_extractor(bootstrap_module, original_handler_name):
    """
    The lambda bootstrap code for python 3.6 was different than for later versions, instead of the _get_handler
    function there was a more complex _get_handlers function with more parameters
    """
    # TODO FIXME Review if the support for python 3.6 bootstrap can be improved.
    # This returns both a init_handler and the function, we apply the init right away as we are in init process
    init_handler, customer_handler_function = bootstrap_module._get_handlers(
        handler=original_handler_name,
        mode='event',  # with 'event' it will return the function as is (handlerfn in the lambda code)
        # 'http' would return wsgi.handle_one(sockfd, ('localhost', 80), handlerfn) instead
        invokeid='unknown_id')  # FIXME invokeid is used for error handling, need to see if we can get it
    init_handler()
    return customer_handler_function