[英]Testing Python “Hello World” in AWS Lambda
I will apologies first hand if my question formatting is messed up. 如果我的问题格式弄乱了,我将第一手道歉。 A noob programmer here
一个菜鸟程序员
I was following steps defined in the AWS Lambda Developer Guide to run the Hello World code. 我正在按照《 AWS Lambda开发人员指南》中定义的步骤运行Hello World代码。 Ref Page 44
参考页44
def my_handler(event, context):
message = 'Hello {} {}!'.format(event['first_name'],
event['last_name'])
return {
'message' : message
}
I believe my error is that the code is looking for events but the input test event on the test page is providing 3 key values which have no relation to my code. 我相信我的错误是代码正在寻找事件,但是测试页面上的输入测试事件提供了3个与我的代码无关的键值。
Make sure the Test Event in the AWS Console provides values that the program expects. 确保AWS控制台中的Test Event提供程序期望的值。 It's passing three keys
key1
, key2
, key3
while the program expects first_name
and last_name
它正在传递三个键
key1
, key2
, key3
而程序需要first_name
和last_name
Just change the Test Event's values to the following instead 只需将Test Event的值更改为以下值
{
"first_name": "foo",
"last_name": "bar
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.