liiight / notifiers

The easy way to send notifications
http://notifiers.readthedocs.io/
MIT License
2.68k stars 108 forks source link
notification-service notifications notifier pypi python python3

Full logo

Build Status Codecov image PyPi version Supported Python versions License Status Docker build RTD Paypal Downloads Twitter Follow Code style: black pre-commit

See changelog for recent changes

Got an app or service, and you want to enable your users to use notifications with their provider of choice? Working on a script and you want to receive notification based on its output? You don't need to implement a solution yourself, or use individual provider libs. A one stop shop for all notification providers with a unified and simple interface.

Supported providers

Pushover, SimplePush, Slack, Gmail, Email (SMTP), Telegram, Gitter, Pushbullet, Join, Zulip, Twilio, Pagerduty, Mailgun, PopcornNotify, StatusPage.io, iCloud, VictorOps (Splunk), Notify

Advantages

Installation

Via pip:

$ pip install notifiers

Via homebrew:

$ brew install notifiers

Or Dockerhub:

$ docker pull liiight/notifiers

Basic Usage

>>> from notifiers import get_notifier
>>> p = get_notifier('pushover')
>>> p.required
{'required': ['user', 'message', 'token']}
>>> p.notify(user='foo', token='bar', message='test')
<NotificationResponse,provider=Pushover,status=Success>

Or:

>>> from notifiers import notify
>>> notify('pushover', user='foo', token='bar', message='test')
<NotificationResponse,provider=Pushover,status=Success>

From CLI

$ notifiers pushover notify --user foo --token baz "This is so easy!"

As a logger

Directly add to your existing stdlib logging:

>>> import logging
>>> from notifiers.logging import NotificationHandler

>>> log = logging.getLogger(__name__)

>>> defaults = {
        'token': 'foo',
        'user': 'bar'
    }
>>> hdlr = NotificationHandler('pushover', defaults=defaults)
>>> hdlr.setLevel(logging.ERROR)

>>> log.addHandler(hdlr)
>>> log.error('And just like that, you get notified about all your errors!')

Mentions

Road map

See Docs for more information

Donations

If you like this and want to buy me a cup of coffee, please click the donation button above or click this link

Code of Conduct

Everyone interacting in the Notifiers project's codebases, issue trackers and chat rooms is expected to follow the PyPA Code of Conduct.