python - 从 AWS lambda 在本地机器上执行代码
问题描述
对于一个大学项目,我创建了一个聊天机器人,它调用用 Python 编写的 lambda 函数。
import webbrowser
import boto3
import logging
from urllib.request import Request, urlopen
import json
def handler(event,callback):
function_type = event['currentIntent']['slots']['slotOne']
print('This went to the search')
webbrowser.open('www.google.com')
response = {
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "SSML",
"content": "opening google now"
},
}
}
return response
我可以在这个 lambda 中发送和接收信息,但我无法使用webbrowser
导入打开 www.google.com。这在本地工作,我想知道是否有办法让我的 lambda 触发器代码本地保存在我的机器上,或者让我的 lambda 代码在我的聊天机器人调用时在本地执行。
解决方案
推荐阅读
- javascript - 具有多个多边形的自定义图像地图 - 添加了地图图标
- vb.net - Visual Studio:仅针对少数特定行覆盖“智能”缩进
- vba - 如何使类变量在 VBA 中的模块之间保持不变
- gcc - 使用 libclang 分析 C 代码时如何指定目标平台?
- opencv - 为什么我需要在 OpenCV 层次聚类中指定聚类数
- c++ - 通过使用指针/引用在 C++ 中使用向量加速计算
- angular - 子组件初始化后,将值从子组件传递给父组件
- android - 在 Xamarin Android 的运行时向用户请求位置权限时应用程序崩溃
- ios - 在 iOS 的 Firebase 测试实验室中测试无密码身份验证
- android-studio - 为什么 Android Studio 会为某些类输入完整路径?