django-ses-sns-tracker
A simple wrapper around django-ses to receive and persist sns event data.
Records mail delivery in the SESMailDelivery model and updates the state if a matching SNS notification is received.
Requirements
- Django version 3.2+
- A PostgreSQL Database
Quick start
-
Add
ses_sns_trackerto your INSTALLED_APPS setting like this:INSTALLED_APPS = [ # ... 'ses_sns_tracker', ]
-
Run
python manage.py migrateto create the models. -
Setup
django-ses -
Add the webhook view to
urls.py:from django_ses.views import SESEventWebhookView urlpatterns = [ # ... path('ses-events/', SESEventWebhookView.as_view(), name='handle-event-webhook'), # ... ]
-
(Optional) Use
ses_sns_tracker.backends.SESSNSTrackerBackendas your default email backend:EMAIL_BACKEND = 'ses_sns_tracker.backends.SESSNSTrackerBackend'This way all emails will be sent via the Amazon SES API.
-
(Optional) Send an email via the
SESMailDeliverymanager (doesn't requireSESSNSTrackerBackendas the default mail backend):from django.core.mail import EmailMessage from ses_sns_tracker.models import SESMailDelivery message = EmailMessage( subject='email subject', body='email body', from_email='sender@example.com', to=['recipient@example.com'], ) SESMailDelivery.objects.create_message(message, fail_silently=False, fake_delivery=False)
Settings
-
SES_SNS_TRACKER_DEBUG_BACKEND = 'django.core.mail.backends.console.EmailBackend'Set mail backend to use for the actual mail delivery in
DEBUGmode (SESMailDeliveryobjects will still be created). Default:None
Development setup
-
Install development dependencies:
poetry install -
Install the ruff extension for code linting & formatting in your IDE.
-
(Optional) Override settings in
example_proj/settings_local.py&tests/settings_local.pyas required.
Metadata
Release files for django-ses-sns-tracker 4.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_ses_sns_tracker-4.0.0.tar.gz | 7.0 kB | Without provenance | Details for django_ses_sns_tracker-4.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_ses_sns_tracker-4.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_ses_sns_tracker-4.0.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / django_ses_sns_tracker-4.0.0.tar.gz
| Download URL | django_ses_sns_tracker-4.0.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d764a188fbfd866797aeed665d173271f12c8bb6372e3d168a35c868d46f4e77
|
|
BLAKE2b-256 checksum How to use checksums |
d6a2d820f058e208d7572c77d8d01ea8905108a87863d3b8cf72e9ba6c919eca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / django_ses_sns_tracker-4.0.0-py3-none-any.whl
| Download URL | django_ses_sns_tracker-4.0.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a48ddd4154bd6cb4caf9195403800b3c06d0bd41fac443a6f00a638c102972b8
|
|
BLAKE2b-256 checksum How to use checksums |
8ac02d370b0a0b08d75a73fa08bfc269c8dda764cfb836b70f7f3f4ef042c8d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for django-ses-sns-tracker 4.0.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.