Skip to main content

A library to ease creation of an Alexa Skills Kit

Project description

# `pylexa`

*NOTE: This library is NOT ready for production use yet!*

`pylexa` is a library that aims to ease development of an [Alexa Skills Kits](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit).

`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](https://developer.amazon.com/edw/home.html#/skills/list)
* 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:

```python
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__)
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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pylexa-0.0.9-py2-none-any.whl (8.2 kB view details)

Uploaded Python 2

File details

Details for the file pylexa-0.0.9-py2-none-any.whl.

File metadata

File hashes

Hashes for pylexa-0.0.9-py2-none-any.whl
Algorithm Hash digest
SHA256 9a93886acfdc3562e1d420c1debe8122706d609375fe337a355a2ed37151b9ef
MD5 568ed97ad8d93c0be9dbced98ca51ac8
BLAKE2b-256 07c94df974f59ec4249e5c4a47f20e5fb3a0c823f6e7ed8c05e8bc9dbc583763

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page