我正在尝试使用python中的flask-ask和ngrok开始为alexa开发技能.以下是我的代码:
from flask import Flask
from flask_ask import Ask, statement, question, session
import json
import requests
import time
import unidecode
app = Flask(__name__)
ask = Ask(app, "/reddit_reader")
def get_headlines():
titles = 'is this working'
return titles
@app.route('/')
def homepage():
return "hi there, how ya doin?"
@ask.launch
def start_skill():
welcome_message = 'Hello there, would you like the news?'
return question(welcome_message)
@ask.intent("YesIntent")
def share_headlines():
headlines = get_headlines()
headline_msg = 'The current world news headlines are
{}'.format(headlines)
return statement(headline_msg)
@ask.intent("NoIntent")
def no_intent():
bye_text …Run Code Online (Sandbox Code Playgroud)