2023-12-14 15:30:07 +01:00
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2024-01-16 10:41:11 -05:00
# SPDX-License-Identifier: Apache-2.0
2023-12-14 15:30:07 +01:00
import datetime
import json
2024-01-13 00:17:30 +01:00
def lambda_handler ( event , context ) :
2023-12-14 15:30:07 +01:00
now = datetime . datetime . now ( )
response = { " date " : now . strftime ( " % Y- % m- %d " ) , " time " : now . strftime ( " % H: % M: % S " ) }
response_body = { " application/json " : { " body " : json . dumps ( response ) } }
action_response = {
" actionGroup " : event [ " actionGroup " ] ,
" apiPath " : event [ " apiPath " ] ,
" httpMethod " : event [ " httpMethod " ] ,
" httpStatusCode " : 200 ,
" responseBody " : response_body ,
}
session_attributes = event [ " sessionAttributes " ]
prompt_session_attributes = event [ " promptSessionAttributes " ]
return {
" messageVersion " : " 1.0 " ,
" response " : action_response ,
" sessionAttributes " : session_attributes ,
" promptSessionAttributes " : prompt_session_attributes ,
}