Skip to main content

Python push-notifications.

Project description

Python Notifications

CI Deploy PyPi Version # of Downloads Supported Python Versions License

Python3 module for sending notifications.

The list of available backends:

  • Platform (pynotifier.backends.platform.Backend):
    • Android (Termux)
    • Linux
    • macOS
    • Windows
  • Email (pynotifier.backends.smtp.Backend)

Platform notifications requirements

Android:

termux-api - Android application for Termux

Linux:

libnotify-bin CLI tool (manual installation is required). For Ubuntu run:

sudo apt-get install libnotify-bin

Windows:

WinToaster - Python module

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.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_notifier2-0.5.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file py_notifier2-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: py_notifier2-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.9

File hashes

Hashes for py_notifier2-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46384d28f344f9246e3fbed023a543d508fb4aae5ce5a985174fda9b44b72406
MD5 6d1807b5673f2b7297717ece2dc3b1e7
BLAKE2b-256 9d83ba11afb46819ccbd9c393bae12840f3df2371e62e107c1bd29ae605bff05

See more details on using hashes here.

Supported by

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