项目作者: pvsune

项目描述 :
Toolkit for writing Amazon Alexa skills in your Falcon app
高级语言: Python
项目地址: git://github.com/pvsune/falcon_ask.git
创建时间: 2017-10-27T06:50:45Z
项目社区:https://github.com/pvsune/falcon_ask

开源协议:

下载


Falcon-Ask Build Status

Minimal Python3 toolkit to create Amazon Alexa skills with Falcon.

Builds on top of Alexa Skills Kit (ASK) to bootstrap boilerplate code so you don’t have to!

Inspired by Flask-Ask and Alexandra.

Synopsis

A Falcon app might look like this.

  1. import json
  2. import falcon
  3. from falcon_ask import dispatch_request, FalconAskMiddleware, respond
  4. def intent_fn(body):
  5. # "body" contains request POST data.
  6. return 'Congratulations! Your new alexa skill works great.'
  7. class AlexaResource(object):
  8. # Dictionary mapping of "IntentRequest" to function.
  9. intent_maps = {
  10. 'GreetingIntent': intent_fn,
  11. }
  12. # Message to return when "LaunchRequest" is received.
  13. welcome = 'Hi, welcome to your new alexa skill.'
  14. def on_post(self, req, resp):
  15. response = dispatch_request(req)
  16. resp.body = json.dumps(respond(response, end_session=False))
  17. app = falcon.API(middleware=[
  18. # Do validation of request certificate and timestamp.
  19. FalconAskMiddleware(AlexaResource, validate=True),
  20. ])
  21. app.add_route('/', AlexaResource())

Save above code to alexa.py and run via $ gunicorn alexa:app. Make sure gunicorn is installed.

Installation

To install Falcon-Ask, simply use pipenv (or pip, of
course):

  1. $ pip install falcon-ask
  2. ✨🍰✨

Satisfaction guaranteed.

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 Falcon-Ask better.

Special thanks to @muxspace for giving me an Echo Dot.