Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Toolkit for writing Amazon Alexa skills in your Falcon app

Project description

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.

import json

import falcon
from falcon_ask import dispatch_request, FalconAskMiddleware, respond


def intent_fn(body):
    # "body" contains request POST data.
    return 'Congratulations! Your new alexa skill works great.'


class AlexaResource(object):
    # Dictionary mapping of "IntentRequest" to function.
    intent_maps = {
        'GreetingIntent': intent_fn,
    }

    # Message to return when "LaunchRequest" is received.
    welcome = 'Hi, welcome to your new alexa skill.'

    def on_post(self, req, resp):
        response = dispatch_request(req)
        resp.body = json.dumps(respond(response, end_session=False))


app = falcon.API(middleware=[
    # Do validation of request certificate and timestamp.
    FalconAskMiddleware(AlexaResource, validate=True),
])
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):

$ pip install falcon-ask
✨🍰✨

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
falcon_ask-1.1.1.tar.gz (4.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page