pushno is a simple Python package that allows the sending of push
notification messages to mobile devices. Currently, it supports the two
services PushOver and
Prowl, but due to its modular structure it can be
extended to other services in the future.
The simplest way to install
pushno is to install it via
pip from PyPi:
pip install -U pushno
Depending on the service that should be used, first, a corresponding account must be created at PushOver or Prowl. Then, a corresponding API key must be generated that should be used in the following.
In the following examples, the simple usage of
pushno is presented.
from pushno import PushNotification 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)
from pushno import PushNotification 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 of the user account is optional and thus, can be omitted when the validity of the user account is assured. As a result, a push notification can be sent in two lines of Python code.
The source code, including several example scripts, can be found in the corresponding github repository https://github.com/keans/pushno.