A library to ease creation of an Alexa Skills Kit
Project description
NOTE: This library is NOT ready for production use yet!
pylexa is a library that aims to ease development of an Alexa Skills Kits.
pylexa allows one to define a simple Flask application that will be able to accept requests and return appropriate responses to the Alexa service.
Example
Let’s say you want to define an Alexa Skill that echoes whatever the user says. So far, you’ve:
created a skill in the Amazon Developer Console
Added a Echo intent with a single slot, message:
javascript { "intent": "Echo", "slots": [ { "name": "message", "type": "AMAZON.LITERAL" } ] }
Added an utterance to allow users to interact with the skill:
Echo echo { something | message }
Now, you’re ready to create a server that will accept the request and return a response echoing the input. Using pylexa, we’d need only the following code to accomplish this:
from flask import Flask
from pylexa.app import alexa_blueprint
from pylexa.intent import handle_intent
from pylexa.response import AlexaResponseWrapper, PlainTextSpeech
app = Flask(__name__)
alexa_blueprint.app_id = 'my_app_id'
app.register_blueprint(alexa_blueprint)
app.response_class = AlexaResponseWrapper
@handle_intent('Echo')
def handle_echo_intent(request):
return PlainTextSpeech(request.slots.get('message', 'Nothing to echo'))
And that’s it! You can push the above code, configure the skill to point to the server running the flask app and use the service simulator to test your skill.
Testing
After installing requirements with pip install -r requirements.pip, tests can be run with nosetests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pylexa-0.0.12-py2-none-any.whl
.
File metadata
- Download URL: pylexa-0.0.12-py2-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2be9207a5eac00f548cb23ec433161230544b82376189a2c9b90d11d51e92aa7 |
|
MD5 | 82e6864d04561b0473a834c9a362c412 |
|
BLAKE2b-256 | 75a6e6d6836457dc2eb17a313b1f9c629f25d2f5fd7541b7039b2a66f515c2a5 |