This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

django-echo

Django library for creating skills for the Amazon Echo (Alexa)

Getting Started

django-echo is mainly composed of three classes:

  • echo.skill.EchoSkill: A subclass of Django’s generic.View that handles routing intents and dealing with request data.
  • echo.request.EchoRequest: A small wrapper around the JSON data in the request from Amazon.
  • echo.response.EchoResponse: A subclass of Django’s http.HttpResponse that knows how to generate a valid Amazon Echo response.

Creating a Skill

A skill is a class that subclasses EchoSkill that provides intent handlers:

from echo.skill import EchoSkill

class HoroscopeSkill(EchoSkill):
    def get_horoscope(self, request, sign):
        # Ignore the sign because astrology is bunk.
        return self.respond(
            "Today you need to act first and ask questions later!",
            card=None,
            should_end_session=True
        )

On the Amazon side you would setup an intent called GetHoroscope that has a sign slot, and when that intent is called this get_horoscope method will be called with the slot data.

The self.respond is a helper method that essentially just acts as a pass-through to EchoResponse. You can also use SSML directly and EchoResponse will set the response up correctly:

self.respond("<speak>Today you need to ask questions first and act later!</speak>")

Then you just need to wire the skill up to your urls.py:

from django.conf.urls import url

from .views import HoroscopeSkill

urlpatterns = [
    url(
        regex=r'^horoscope/$',
        view=HoroscopeSkill.as_view(),
        name='horoscope_skill'
    )
]

Responding With A Card

EchoSkill provides a helper to create a simple card:

return self.respond(
    "What alexa should say",
    card=self.create_simple_card("The card title", "The card's content")
)

Session Handling

EchoSkill sets self.request to an instance of EchoRequest (it also saves the http request to self.http_request.) EchoRequest provides the session attributes via a session attribute:

sign = self.request.session.get('sign')

request.session.update({
    'has_requested_horoscope': True
})

If you use EchoSkill.respond this session data will be automatically attached to the response, otherwise you’ll need to pass it when creating the response:

return EchoResponse("Output text", session=self.request.session)
Release History

Release History

0.2.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-echo-0.2.2.tar.gz (8.9 kB) Copy SHA256 Checksum SHA256 Source Mar 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting