A Django view that can be subscribed to Amazon SNS
Project description
.. image:: https://travis-ci.org/deep-c/django-sns-view.svg?branch=master
:target: https://travis-ci.org/deep-c/django-sns-view
===============
Django SNS View
===============
A drop in configurable django view that is used to subscribe and process AWS SNS messages.
Installation
------------
.. code-block:: bash
pip install django-sns-view
Default Django Settings
----------------------
.. code-block:: python
SNS_CERT_DOMAIN_REGEX = r"sns.[a-z0-9\-]+.amazonaws.com$" # Regex to match on cert domain
SNS_VERIFY_CERTIFICATE = True # Whether to verify signature against certificate
SNSEndpoint Attributes
----------------------
.. code-block:: python
message_type_header = 'HTTP_X_AMZ_SNS_MESSAGE_TYPE'
topic_type_header = 'HTTP_X_AMZ_SNS_TOPIC_ARN'
allowed_message_types = ['Notification', 'SubscriptionConfirmation', 'UnsubscribeConfirmation']
cert_domain_settings_key = 'SNS_CERT_DOMAIN_REGEX'
sns_verify_settings_key = 'SNS_VERIFY_CERTIFICATE'
topic_settings_key = '' # If you would like to subscribe this endpoint only certain topics, create a setting containing a list of topics that are allowed.
Usage
-----------
.. code-block:: python
from django_sns_view.views import SNSEndpoint
class MySNSView(SNSEndpoint):
# Can override SNSEndpoint attributes outlined above
def handle_message(self, message, payload):
# Process the message
:target: https://travis-ci.org/deep-c/django-sns-view
===============
Django SNS View
===============
A drop in configurable django view that is used to subscribe and process AWS SNS messages.
Installation
------------
.. code-block:: bash
pip install django-sns-view
Default Django Settings
----------------------
.. code-block:: python
SNS_CERT_DOMAIN_REGEX = r"sns.[a-z0-9\-]+.amazonaws.com$" # Regex to match on cert domain
SNS_VERIFY_CERTIFICATE = True # Whether to verify signature against certificate
SNSEndpoint Attributes
----------------------
.. code-block:: python
message_type_header = 'HTTP_X_AMZ_SNS_MESSAGE_TYPE'
topic_type_header = 'HTTP_X_AMZ_SNS_TOPIC_ARN'
allowed_message_types = ['Notification', 'SubscriptionConfirmation', 'UnsubscribeConfirmation']
cert_domain_settings_key = 'SNS_CERT_DOMAIN_REGEX'
sns_verify_settings_key = 'SNS_VERIFY_CERTIFICATE'
topic_settings_key = '' # If you would like to subscribe this endpoint only certain topics, create a setting containing a list of topics that are allowed.
Usage
-----------
.. code-block:: python
from django_sns_view.views import SNSEndpoint
class MySNSView(SNSEndpoint):
# Can override SNSEndpoint attributes outlined above
def handle_message(self, message, payload):
# Process the message
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 Distribution
django-sns-view-0.1.2.tar.gz
(10.6 kB
view details)
File details
Details for the file django-sns-view-0.1.2.tar.gz
.
File metadata
- Download URL: django-sns-view-0.1.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 019253530361db739ad0a83f13b99e380fe2ead766995263fd6f51ae853ccd30 |
|
MD5 | 76e27e2e5a497d68cba262db8937c9e2 |
|
BLAKE2b-256 | 7d36852fa920a6c0ce68659aac08b1e806ea4027a4bedd197d9f08bc8c97a777 |