我正在研究一种简单的python amazon alexa技能。我已经为这个简单的应用程序编写了所有代码,并将其加载到我的lambada函数中我已经测试过lambada已加载了导入的库,并且可以使用它们,但是当我使用此最终代码时,它会收到“请求的技能响应有问题”
def handle(self, handler_input):
# type: (HandlerInput) -> Response
# https://repl.it/repls/UselessOptimalPipeline
url = "http://jokepro.dx.am/"
source = requests.get(url)
bs4call = bs4.BeautifulSoup(source.text, "html.parser")
obj = bs4call.find('object')
text = requests.get(url + obj['data']).text
# print(text) # <-- to print the textfile
finalJoke = random.choice(text.splitlines())
speak_output = finalJoke
return (
handler_input.response_builder
.speak(speak_output)
#.ask()
.response
)
这是处理程序功能
lambada是否与该代码中的任何内容冲突?为什么它不起作用?
更新:这是一些相关信息
requirements.txt
boto3==1.9.216
ask-sdk-core==1.11.0
bs4==4.8.2
requests==2.22.0
这完全不是通过Amazon开发者控制台https://developer.amazon.com/alexa/console/ask进行的
[您的Lambda函数似乎没有使用SkillBuilder
。