Пример #1
0
def lambda_handler(event, context):
    """ Route the incoming request based on type (LaunchRequest, IntentRequest,
    etc.) The JSON body of the request is provided in the event parameter.
    """
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])
    """
    Uncomment this if statement and populate with your skill's application ID to
    prevent someone else from configuring a skill that sends requests to this
    function.
    """
    # if (event['session']['application']['applicationId'] !=
    #         "amzn1.echo-sdk-ams.app.[unique-value-here]"):
    #     raise ValueError("Invalid Application ID")

    if event['session']['new']:
        on_session_started({'requestId': event['request']['requestId']},
                           event['session'])
    print(event['session'])
    if event['request']['type'] == "LaunchRequest":
        return on_launch(event['request'], event['session'])
    elif event['request']['type'] == "IntentRequest":
        return on_intent(event['request'], event['session'])
    elif event['request']['type'] == "SessionEndedRequest":
        return on_session_ended(event['request'], event['session'])
def lambda_handler(event: Dict[str, Any],
                   _context: Dict[str, Any]) -> AlexaResponse:
    log_event_to_cloudwatch(event)
    validate_application_id(event)

    request_type: str = event["request"]["type"]

    if request_type == "LaunchRequest":
        return events.on_launch()

    if request_type == "IntentRequest":
        return events.on_intent(event["request"], event["context"])
def lambda_handler(event, context):
    print (str(event) + " context: " + str(context));

    if event['session']['new']:
        events.on_session_started({'requestId': event['request']['requestId']},
                           event['session'])

    if event['request']['type'] == "LaunchRequest":
        return events.on_launch(event['request'], event['session'])

    elif event['request']['type'] == "IntentRequest":
        return events.on_intent(event['request'], event['session'])

    elif event['request']['type'] == "SessionEndedRequest":
        return events.on_session_ended(event['request'], event['session'])
Пример #4
0
def lambda_handler(event, context):
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])
    """
    Uncomment this if statement and populate with your skill's application ID to
    prevent someone else from configuring a skill that sends requests to this
    function.
    """
    # if (event['session']['application']['applicationId'] !=
    #         "amzn1.echo-sdk-ams.app.[unique-value-here]"):
    #     raise ValueError("Invalid Application ID")

    if event['session']['new']:
        events.on_session_started({'requestId': event['request']['requestId']},
                                  event['session'])

    if event['request']['type'] == "LaunchRequest":
        return events.on_launch(event['request'], event['session'])
    elif event['request']['type'] == "IntentRequest":
        return events.on_intent(event['request'], event['session'])
    elif event['request']['type'] == "SessionEndedRequest":
        return events.on_session_ended(event['request'], event['session'])
Пример #5
0
def lambda_handler(event, context):
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])
    """
    Uncomment this if statement and populate with your skill's application ID to
    prevent someone else from configuring a skill that sends requests to this
    function.
    """
    if (event['session']['application']['applicationId'] !=
            "amzn1.ask.skill.{0}".format(alexa_id)):
        print("amzn1.ask.skill.{0}".format(alexa_id))
        raise ValueError("Invalid Application ID")

    # if event['session']['new']:
    #     events.on_session_started({'requestId': event['request']['requestId']},
    #                        event['session'])

    request_type = event['request']['type']

    if request_type == "LaunchRequest":
        return events.on_launch(event['request'], event['session'])
    elif request_type == "IntentRequest":
        return events.on_intent(event['request'], event['session'])