Skip to main content

User notification library with pluggable backends. Compatible with popular frameworks such as Django, Flask, Celery.

Project description

Pluggable notifications for your Python apps.

yell is not a notification storage or delivery backend but a set of APIs that make it easy to add your own delivery mechanisms.

The full documentation is available here.

Using notification decorators

from yell import notify
from yell.decorators import notification

@notification(name = 'buffalo')
def buffalo_printer(message):
    print message

@notification(name = 'buffalo')
def buffalo_saver(message):
    save(message)

notify("buffalo", _("Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo"))

Using notification classes

from yell import Notification, notify

class Buffalo(Notification):
    name = "buffalo"
    message = _("Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo")

    def notify(self, *args, **kwargs):
        print self.message

class BuffaloEmail(Buffalo):
    def notify(self, *args, **kwargs):
        send_mail("Buffalo", self.message, 'buffalo@example.com', [kwargs.get('user').email])

class BuffaloDatabase(Buffalo):
    def notify(self, *args, **kwargs):
        BuffaloModel.objects.create(user = kwargs.get('user'))

# The default behaviour is to use every notification backend with the same
# name
notify("buffalo", user = User.objects.get(id=1))

# Only send emails
notify("buffalo", user = User.objects.get(id=1), backends = [BuffaloEmail])

Changelog

v0.3

  • backwards incompatible Guessing the file extension with the mimetypes package proved to be inconsistent across systems. TemplatedEmailBackend now makes use of explicitly declared file extensions.

v0.2

  • Made the API saner to use (backwards incompatible):

    • yell.Yell became yell.Notification

    • yell.yell became yell.notify

    • yell.decorators.yelling became yell.decorators.notification

Project details


Download files

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

Source Distribution

yell-0.3.2.tar.gz (5.9 kB view details)

Uploaded Source

File details

Details for the file yell-0.3.2.tar.gz.

File metadata

  • Download URL: yell-0.3.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yell-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5452b3b6470725716c1ab8f414e731cf570720e98c1c007c8b7b2dd6e6d6b785
MD5 c89b6cf3a68cfc56184bbd97c55c355d
BLAKE2b-256 c0fb6f703d73788adfba5294433b2693dc4fb5a1dfeb8ed80cdbb2cc44d9dfa8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page