Python Notifications
Python3 module for sending notifications.
The list of available backends:
- Platform (
pynotifier.backends.platform.Backend):- macOS
- Linux
- Windows
- Email (
pynotifier.backends.smtp.Backend)
Platform notifications requirements
Windows:
WinToaster - Python module
Linux:
libnotify-bin CLI tool (manual installation is required). For Ubuntu run:
sudo apt-get install libnotify-bin
Installation
Install using pip:
pip install py-notifier
Example
import ssl
import smtplib
from pynotifier import NotificationClient, Notification
from pynotifier.backends import platform, smtp
smtp_server = smtplib.SMTP_SSL('smtp.gmail.com', 465, context=ssl.create_default_context())
c = NotificationClient()
c.register_backend(platform.Backend())
c.register_backend(smtp.Backend(server=smtp_server,
name='My Organization',
email='sender@organization.com',
password='super_password'))
filenames = [
'path/to/file1.json',
'path/to/file2.txt',
# ...
]
attachments = []
for filename in filenames:
attachments.append(smtp.Attachment(open(filename, 'rb'), filename))
smtp_config = smtp.NotificationConfig(emails=['receiver_1@email.com', 'receiver_2@email.com'],
attachments=attachments)
notification = Notification(title='Hello', message='World', smtp=smtp_config)
c.notify_all(notification)
License
The project is licensed under the terms of the MIT License, see the LICENSE file for more information.
Release files for py-notifier 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py-notifier-0.5.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_notifier-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / py-notifier-0.5.0.tar.gz
| Download URL | py-notifier-0.5.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88445d25a20f901f4821cc7a17bf8f873c11c2316288083afb1277bd1a8d6112
|
|
BLAKE2b-256 checksum How to use checksums |
95431c61910687afd4e896b504d61dcb7eecb7c2816d5f154237853fafc143eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / py_notifier-0.5.0-py3-none-any.whl
| Download URL | py_notifier-0.5.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb75a4ae1ed7839b5794dc94c0dd5b38e791c32f53041e99c64f71d9a1dfb8d3
|
|
BLAKE2b-256 checksum How to use checksums |
cb93922e37bfd08533315863b9afb2184377c540a8b2545b0ded1b459c4ffbdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|