All Projects → erik → Alexandra

erik / Alexandra

Licence: isc
Python toolkit for writing Amazon Echo skills as web services

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Alexandra

Awesome Clojure
Stars: ✭ 17 (-81.11%)
Mutual labels:  libraries
Alexa App
A framework for Alexa (Amazon Echo) apps using Node.js
Stars: ✭ 1,015 (+1027.78%)
Mutual labels:  amazon-echo
Vitamin Web
Decathlon Design System libraries for web applications
Stars: ✭ 70 (-22.22%)
Mutual labels:  libraries
Awesome ai for libraries
A list of awesome artificial intelligence resources for the GLAM community.
Stars: ✭ 12 (-86.67%)
Mutual labels:  libraries
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (-55.56%)
Mutual labels:  libraries
Turkishid
Validator/generator for Turkish Republic Citizen ID numbers (TC Kimlik No)
Stars: ✭ 49 (-45.56%)
Mutual labels:  libraries
Android Hot Libraries
收集总结 Android 项目中值得推荐的优秀开源项目
Stars: ✭ 755 (+738.89%)
Mutual labels:  libraries
Minio Go
MinIO Client SDK for Go
Stars: ✭ 1,231 (+1267.78%)
Mutual labels:  libraries
Django Icekit
GLAMkit is a next-generation Python CMS by the Interaction Consortium, designed especially for the cultural sector.
Stars: ✭ 42 (-53.33%)
Mutual labels:  libraries
Ultimate Resources Android Devs
Compiled & Curated List of Resources for Android Developers
Stars: ✭ 68 (-24.44%)
Mutual labels:  libraries
Awesome Cpp
A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff.
Stars: ✭ 35,136 (+38940%)
Mutual labels:  libraries
Bit
Bitcoin made easy.
Stars: ✭ 958 (+964.44%)
Mutual labels:  libraries
Simplebase
.NET library for encoding/decoding Base16, Base32, Base58 and Base85.
Stars: ✭ 64 (-28.89%)
Mutual labels:  libraries
M2x Python
AT&T M2X Python Library
Stars: ✭ 25 (-72.22%)
Mutual labels:  libraries
Symbol Instance Sheet
Generate a sheet of symbol instances from your current document or a library.
Stars: ✭ 72 (-20%)
Mutual labels:  libraries
Alexa Skills Kit Sdk For Java
The Alexa Skills Kit SDK for Java helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 758 (+742.22%)
Mutual labels:  amazon-echo
Inqlude Data
Library meta data for independent Qt library archive
Stars: ✭ 44 (-51.11%)
Mutual labels:  libraries
Rust Game Development Frameworks
List of curated frameworks by the **Game Development in Rust** community.
Stars: ✭ 81 (-10%)
Mutual labels:  libraries
Awesome Hpp
A curated list of awesome header-only C++ libraries
Stars: ✭ 1,198 (+1231.11%)
Mutual labels:  libraries
Version Checker Gradle Lint
Warning on new versions available even when using Kotlin-DSL plugin.
Stars: ✭ 68 (-24.44%)
Mutual labels:  libraries

alexandra

|Build Status|

Minimal Python library to remove the tedious boilerplate-y parts of writing Alexa skills. Alexandra is tested against Python 2.7 and 3.6.

Alexandra can be used as part of an AWS lambda function or a self-hosted server. There's a builtin WSGI app if you're in to that kind of thing.

Check out the api documentation <http://alexandra.rtfd.org/>__ for more details on what alexandra can do.

.. code:: python

import alexandra

app = alexandra.Application()
name_map = {}

@app.launch
def launch_handler():
    return alexandra.reprompt('What would you like to do?')

@app.intent('MyNameIs')
def set_name_intent(slots, session):
    name = slots['Name']
    name_map[session.user_id] = name

    return alexandra.respond("Okay, I won't forget you, %s" % name)

@app.intent('WhoAmI')
def get_name_intent(slots, session):
    name = name_map.get(session.user_id)

    if name:
        return alexandra.respond('You are %s, of course!' % name)

    return alexandra.reprompt("We haven't met yet! What's your name?")

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

installing

Alexandra uses pyOpenSSL, which requires the libffi library to compile. Make sure that's installed first.

If you're on OS X, check out the special instructions <https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x>__ for installing the OpenSSL library if you get errors during installation.

And then:

pip install alexandra

using alexandra with aws lambda

Getting an alexandra app running on lambda is much easier than running your own server, and is probably the right choice unless you need to access the local network or have some other complication that prevents you from using the service.

Here's an example:

.. code:: python

app = alexandra.Application()

@app.intent('FooBar')
def foo_bar():
    ...

# Entry point to our lambda function.
def lambda_handler(event, context):
    return alexa.dispatch_request(event)

running with uwsgi

The alexandra.Application class has a run method, which is useful enough for testing purposes and simple projects, but for real deployments, you'll probably want to use something a little more robust, such as uWSGI.

Alexandra works with uwsgi in almost exactly the same way Flask does.

.. code:: python

# skill_module.py

app = alexandra.Application()
wsgi_app = app.create_wsgi_app()

@app.intent('FooBar')
def foobar():
    ...

The above can be run with uwsgi as uwsgi -w skill_module:wsgi_app --http 0.0.0.0:5678

setting up a web server

Amazon requires a real SSL certificate for skills to be rolled out to other users, but fortunately for testing and personal projects self-signed certificates are acceptable.

To make it a bit easier to generate a self signed SSL certificate and nginx configuration, here's a Python 2.7/3.5.1 compatible standalone script <https://gist.github.com/erik/119dd32efc269d6dd5d7>_ to generate basic config for a standard unix setup.

After running the script, simply add a location block to the nginx config for any new Alexa skills being hosted on the same box.

For example, if there's an alexandra skill running on port 6789, you would add:

::

location /some_random_endpoint {
    proxy_pass http://localhost:6789;
}

.. |Build Status| image:: https://travis-ci.org/erik/alexandra.svg?branch=master :target: https://travis-ci.org/erik/alexandra

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].