PIP-Talk - Week 35

Every week going forward I plan to write a little about interesting modules/libraries available for Python.

The topic for this week is: Apprise


Background: Apprise

Apprise allows you to send a notification to almost all of the most popular notification services available to us today such as: Telegram, Discord, Slack, Amazon SNS, Gotify, etc.

  • One notification library to rule them all.
  • A common and intuitive notification syntax.
  • Supports the handling of images and attachments (to the notification services that will accept them).
  • It’s incredibly lightweight.
  • Amazing response times because all messages sent asynchronously.

Whats the use case, what problem does it solve ?

Apprise will manage and setup your notification easy as pie.

Theres no need to build and maintain your own notification service when there are great modules like this. Once the configuration is in place you could use any/many of the available and supported notification services. You can find notification services for almost any existing service. If would need new destinations in the future, you could easily add them later.

You Why not extend your critical logging with a easy and simple notification (use a simple configuration file to manage your destinations) ?


Sources


Install

pip install apprise

Example

To send a notification from within your python application, just do the following:

import apprise

# Create an Apprise instance
apobj = apprise.Apprise()

# Add all of the notification services by their server url.
# A sample email notification:
apobj.add('mailto://myuserid:[email protected]')

# A sample pushbullet notification
apobj.add('pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b')

# Then notify these services any time you desire. The below would
# notify all of the services loaded into our Apprise object.
apobj.notify(
    body='what a great notification service!',
    title='my notification title',
)