Skip to main content

notifierlib

A library that implements a kind of fan-out pattern, sending messages to very different endpoints. Extendable through the implementation of custom Channels.

Features

Introduced concepts are:

  • Channels

    A channel is a communication endpoint capable of sending some type of message exposing a “notify” method.

  • Groups

    A group is a construct bringing channels together under a common entrypoint showing up as a method call of the main Notifier object.

  • Notifier

    The main object bringing together channels as broadcast by default and exposing methods to register and unregister channels and add and remove groups.

The payload of the notification methods is by convention a dictionary with at least a “subject” and a “message” key with the appropriate values. It is designed like this so it can be very easy to implement much more complex structures like templates without needed any domain knowledge on all the channels.

Each channel can implement their own template as in instantiation argument in their class and handle the interpolation of variables in the notify method.

An example could be :

from notifierlib.channels import Email
from notifierlib import Notifier, Group

import logging
logging.basicConfig(level=logging.DEBUG)
template='<b>{{subject}}</b> <i>{{message}}</i> <a href="http://google.com">link</a>.'

email=Email('email',
            sender='sender@gmail.com',
            recipient='recipient@gmail.com',
            smtp_address='smtp.domain.com',
            username='smtp_username',
            password='smtp_password',
            tls=True,
            ssl=False,
            port=587,
            template=template,
            content='html')

notifier=Notifier()
notifier.register(email)
notifier.broadcast(subject='this is a test of a template', message="""this is a nice and long message""")

The above would render the template with the provided values on the notify method of the email channel before the mail gets sent.

For a more detailed explanation please see the USAGE.rst file.

History

0.0.1 (18-09-2017)

  • First code creation

1.0.0 (07-07-2021)

  • Dropped support for python2.7, implemented a pipeline and bumped dependencies.

Metadata

Release files for notifierlib 1.0.0

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

Source distribution (sdist)

Source distribution for notifierlib 1.0.0
File Size Uploaded Provenance Actions
notifierlib-1.0.0.tar.gz 56.8 kB Without provenance Details for notifierlib-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for notifierlib 1.0.0
File Interpreter ABI Platform Actions
notifierlib-1.0.0-py3.7.egg Legacy Egg format - - Details for notifierlib-1.0.0-py3.7.egg

Total release size: 93.6 kB

Release files / notifierlib-1.0.0.tar.gz

Download URL notifierlib-1.0.0.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2a368141a36738659427444715dcd5c78b7de0db83ab4260434b25227e9cafda
BLAKE2b-256 checksum
How to use checksums
644ed0cb7a92793acdb8f2be53d4cdddde9a65e6e8ed9e6014bb4eb7129727a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

Release files / notifierlib-1.0.0-py3.7.egg

Download URL notifierlib-1.0.0-py3.7.egg
Size 36.8 kB
Tags Egg
SHA-256 checksum
How to use checksums
199875d6fe347210f1d0bf86a6028580a4686313476df716b8e60ef837d55227
BLAKE2b-256 checksum
How to use checksums
fa595d478109622dcc664a2deb7c38208b7ba9f0608ec8a1d472a5f867805320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.10

Security for notifierlib 1.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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