小编Rog*_*hat的帖子

Alexa Skill开发使用flask-ask和ngrok

我正在尝试使用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)

python alexa ngrok alexa-skill

9
推荐指数
1
解决办法
3920
查看次数

标签 统计

alexa ×1

alexa-skill ×1

ngrok ×1

python ×1