Skip to main content

Stay informed of it

Project description

Django Whisperer

Build status Documentation status PyPI PyPI - Django version PyPI - Python version PyPI - License

Whisperer informs subscribed users via an URL when a specific event occurs.


Installation using pip:

pip install dj-whisperer

whisperer package has to be added to INSTALLED_APPS and migrate command has to be run.

    # other apps here...

Sample Scenario

Let's give an example using Package model. When an event occurs related to a package, subscribed users are gonna be informed. To do so, firstly which events to subscribe must be determined. In order to learn when a package created:

### ###

from import WhispererEvent, registry
from whisperer.tasks import deliver_event
from django.db.models.signals import post_save

class PackageCreateEvent(WhispererEvent):
    serializer_class = PackageSerializer
    event_type = 'package-created'


def signal_receiver(instance, created=False, **kwargs):
    if created:
        deliver_event(instance, 'package-created')

post_save.connect(signal_receiver, Package)

When database transaction succeeds, in short when transaction.on_commit(), deliver_event must be triggered. Subscribed users now can be informed that a package created if they have created a Webhook.

import requests'',
                  'Authorization': 'Token <secret-login-token>',
                  'Content-Type': 'application/json'
                  'event_type': 'package-created',
                  'secret_key': 'secret',
                  'target_url': ''

When a package created, uuid, type & data passed through PackageSerializer will be posted to

import requests'',
                  'Content-Type': 'application/json',
                  'X-Whisperer-Event': 'package-created'
                  'event': {
                      'type': 'package-created',
                      'uuid': 'da81e85139824c6187dd1e58a7d3f971'
                  'data': {
                      'id': 61,
                      'transfer_id': 49,
                      'order_number': '248398923123',
                      '.....': '......'

In order to cancel the subscription:

import requests

                    'Authorization': 'Token <secret-login-token>'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dj-whisperer, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size dj_whisperer-0.0.5-py3-none-any.whl (12.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dj-whisperer-0.0.5.tar.gz (15.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page