26.05.2016       Выпуск 127 (23.05.2016 - 29.05.2016)       Интересные проекты, инструменты, библиотеки

flask-ask - toolkit для написания приложений для Amazon Echo

Читать>>




Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.

README.rst

http://flask-ask.readthedocs.io/en/latest/_images/logo-full.png

Rapidly develop Alexa Skills for Amazon Echo devices using Python

Use with ngrok to eliminate the deploy-to-test step and get work done faster.

☤ The Basics

A Flask-Ask application looks like this:

from flask import Flask, render_template
from flask.ext.ask import Ask, statement

app = Flask(__name__)
ask = Ask(app)

@ask.intent('HelloIntent')
def hello(firstname):
    text = render_template('hello', firstname=firstname)
    return statement(text).simple_card('Hello', text)

if __name__ == '__main__':
    app.run(debug=True)

In the code above:

  • The intent decorator maps an intent request named HelloIntent to a view function hello.
  • The intent's firstname slot is implicitly mapped to hello's firstname parameter.
  • Jinja templates are supported. Internally, templates are loaded from a YAML file (discussed further below).
  • Lastly, a builder constructs a spoken response and displays a contextual card in the Alexa smartphone/tablet app.

Since Alexa responses are usually short phrases, it's convenient to put them in the same file. Flask-Ask has a Jinja template loader that loads multiple templates from a single YAML file. For example, here's a template that supports the minimal voice interface above.Templates are stored in a file called templates.yaml located in the application root:

More code and template examples are in the samples directory.

☤ Features

Flask-Ask handles the boilerplate, so you can focus on writing clean code. Flask-Ask:

  • Verifies Alexa request signatures
  • Provides decorators that map ASK requests to view functions
  • Helps construct ask and tell responses, reprompts and cards
  • Makes session management easy
  • Allows for the separation of code and speech through Jinja templates

☤ Installation

To install Flask-Ask:

pip install flask-ask
✨👌✨

☤ 5-Minute Tutorial

See how fast and easy it is to develop Alexa Skills with Flask-Ask and Ngrok

5-minute Flask-Ask and ngrok tutorial.

☤ Documentation

http://flask-ask.readthedocs.org

☤ Todo

☤ Thank You

Thanks for checking this library out! I hope you find it useful.

Of course, there's always room for improvement. Feel free to open an issue so we can make Flask-Ask better.






Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus