Skip to main content

Alexa Browser Client

code-climate-image circle-ci-image codecov-image gemnasium-image

Alexa client in your browser. Django app. Talk to Alexa from your desktop, phone, or tablet browser.


Dependencies

This project depends on: - django-channels. - Snowboy

Install and configure those first.

Snowboy

Snowboy detects when the wakeword “Alexa” is uttered.

You must compile Snowboy manually. Copy the compiled snowboy folder to the top level of you project. By default, the folder structure should be:

.
├── ...
├── snowboy
|   ├── snowboy-detect-swig.cc
|   ├── snowboydetect.py
|   └── resources
|       ├── alexa.umdl
|       └── common.res
└── ...

If the default folder structure does not suit your needs you can customize the wakeword detector.

Installation

pip install alexa_browser_client

Add alexa_browser_client to your settings INSTALLED_APPS.

Routing and urls

Add url(r'^', include('alexa_browser_client.config.urls')), to urls.py url_patterns.

Add include('alexa_browser_client.config.routing.channel_routing') to your routing.py channel_routing.

Authentication

This app uses Alexa Voice Service. To use AVS you must first have a developer account. Then register your product here. Choose “Application” under “Is your product an app or a device”?

Ensure you update your settings.py:

Setting

Notes

ALEXA_BROWSER_CLIENT_AVS_CLIENT_I D

Retrieve by clicking on the your product listed here

ALEXA_BROWSER_CLIENT_AVS_CLIENT_S ECRET

Retrieve by clicking on the your product listed here

ALEXA_BROWSER_CLIENT_AVS_REFRESH_ TOKEN

You must generate this. See here

ALEXA_BROWSER_CLIENT_AVS_DEVICE_T YPE_ID

Retrieve by reading “Product ID” here

Refresh token

You will need to login to Amazon via a web browser to get your refresh token.

To enable this first go here and click on your product to set some security settings under Security Profile:

setting

value

Allowed Origins

https://localhost:9000

Allowed Return URLs

https://localhost:9000/callback/

Then run:

./manage.py create_amazon_refresh_token

Follow the on-screen instructions shown at http://localhost:9000 in your web browser. On completion Amazon will return your refresh_token. Set yourALEXA_BROWSER_CLIENT_AVS_REFRESH_TOKEN setting accordingly.

Usage

Once you have all the settings configured:

  • Run django: ./manage.py runserver

  • Go to http://localhost:8000/alexa-browser-client/ and start talking to Alexa.

Customization

Wakeword

The default wakeword is “Alexa”. You can change this by customizing the lifecycle’s audio_detector_class:

# my_project/custom.py

import alexa_browser_client
import command_lifecycle


class CustomAudioDetector(command_lifecycle.wakeword.SnowboyWakewordDetector):
    wakeword_library_import_path = 'dotted.import.path.to.wakeword.Detector'
    resource_file = b'path/to/resource_file.res'
    decoder_model = b'path/to/model_file.umdl'


class CustomAudioLifecycle(alexa_browser_client.AudioLifecycle):
    audio_detector_class = CustomAudioDetector

Then in your settings.py, change settings.AUDIO_LIFECYCLE_CLASS to the new custom audio lifecycle:

ALEXA_BROWSER_CLIENT_LIFECYCLE_CLASS = 'my_project.custom.CustomAudioLifecycle'

Unit test

To run the unit tests, call the following commands:

pip install -r requirements-dev.txt
./scripts/tests.sh

Other projects

This project uses Voice Command Lifecycle and Alexa Voice Service Client.

Metadata

Release files for alexa-browser-client 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for alexa-browser-client 0.4.0
File Interpreter ABI Platform Actions
alexa_browser_client-0.4.0-py3-none-any.whl Python 3 none any Details for alexa_browser_client-0.4.0-py3-none-any.whl

Release files / alexa_browser_client-0.4.0-py3-none-any.whl

Download URL alexa_browser_client-0.4.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d5f0d9526f0398f05afa18e1d42363d3fecd4c56729fa7d35e103438547fa3b
BLAKE2b-256 checksum
How to use checksums
3b96af70855ab752df396b0ad65c415ca146c14a96e40bf05f5842a030ab2153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for alexa-browser-client 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page