Skip to main content

pushno is a Python package for sending push notifications to mobile devices. It provides a simple, common interface for sending push notifications via the two services PushOver and Prowl.

pushno focuses on Python 3.x so there will be no legacy support for Python 2.x. Due to its modular structure theoretically further services can be added.

Module Installation

The easiest way to install the newest version of the pushno module is via pip:

pip install -U pushno

or clone/download this repository and install it:

python setup.py install

Basic Setup

In the first step, you need to setup an account at PushOver or Prowl and create a corresponding API key that you want to use.

Examples

The easiest way to send a push message with pushno is to use the PushNotification class that provides a common interface to all available push notification services.

Prowl

For Prowl do:

from pushno import PushNotification

PUSHNO_PROWL_API_KEY = "<your_prowl_api_key>"

pn = PushNotification(
    "prowl", api_key=PUSHNO_PROWL_API_KEY, application="pushno"
)
is_valid, res = pn.validate_user()
if is_valid:
    pn.send(event="How simple is that?", description="Great News")
else:
    print(res)

PushOver

For PushOver do:

from pushno import PushNotification

PUSHNO_PUSHOVER_API_KEY = "<your_pushover_api_key>"
PUSHNO_PUSHOVER_USER_KEY = "<your_pushover_user_key>"

pn = PushNotification(
    "pushover", token=PUSHNO_PUSHOVER_API_KEY,
    user=PUSHNO_PUSHOVER_USER_KEY
)
is_valid, res = pn.validate_user()
if is_valid:
    pn.send(title="How simple is that?", message="Great News")
else:
    print(res)

Note that the validation part is optional, so if you are sure that the API key is working as expected, you can send the push message directly. As a result, you can send a push message in two lines of code. The API key is the key of the specific app.

It is also possible to use the underlying client classes directly, which is however a little bit more verbose:

Prowl

from pushno.plugins import ProwlClient
from pushno.messages import ProwlMessage

# prepare the pushover client
client = ProwlClient(PUSHNO_PROWL_API_KEY)

# validate the user key
is_valid, res = client.validate_user()
if is_valid is True:
    # key is still valid => send a notification message
    res = client.send(
        ProwlMessage(
            application="pushno",
            event="How simple is that?",
            description="Great News"
        )
    )
    print(res)

else:
    print(res)

PushOver

from pushno.plugins import PushOverClient
from pushno.messages import PushOverMessage

# prepare the pushover client
client = PushOverClient(PUSHNO_PUSHOVER_API_KEY, PUSHNO_PUSHOVER_USER_KEY)

# validate the user key
is_valid, res = client.validate_user()
if is_valid is True:
    # key is still valid => send a notification message
    client.send(
        PushOverMessage(
            title="Great News",
            message="How simple is that?"
        )
    )

else:
    print(res["errors"])

Again the validation part of the user’s API key is optional.

For the complete example scripts see https://github.com/keans/pushno/tree/master/examples .

Development

If you want to contribute in the development, please check out the source code at https://github.com/keans/pushno.git .

To get started with the development:

git clone git@github.com:keans/pushno.git
cd pushno/
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

For verbose debug output simply set the logging level to debug:

import logging
logging.basicConfig(level=logging.DEBUG)

Release files for pushno 0.0.3

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

Source distribution (sdist)

Source distribution for pushno 0.0.3
File Size Uploaded
pushno-0.0.3.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pushno 0.0.3
File Interpreter ABI Platform
pushno-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 19.5 kB

Release files / pushno-0.0.3.tar.gz

Download URL pushno-0.0.3.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
44385aab29a49d957fd7e818164dc72d8a4d0bb97cb530f1af4a6c7a71708226
BLAKE2b-256 checksum
How to use checksums
de09ddf100187c8c6e49afdad832900d61790f8dd7adeda67286b6a315fe8530
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pushno-0.0.3-py2.py3-none-any.whl

Download URL pushno-0.0.3-py2.py3-none-any.whl
Size 11.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1b580d5ecb613acfc15df5c8964f751d8f672865a9fab810803c492e81c94cf5
BLAKE2b-256 checksum
How to use checksums
a7eaa477c0028a3d3e7dcaf4fd3010ca34facfba35eb33a062df09550c0cc87c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

1 release file

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