Skip to main content

Comprehensive bindings and command line utility for the Pushover notification service

Project description

python-pushover aims at providing comprehensive Python bindings for the API of the Pushover Notification Service as documented here.

** This is a fork of python-pushover with patches for the latest Python3 **

** No other changes have been made **

Installation

You can install python-pushover2 from Pypi with:

$ pip install python-pushover

Or you can install it directly from GitHub:

git clone https://github.com/m4rkw/python-pushover2.git
cd python-pushover2
pip install .

Overview

After being imported, the module must be initialized by calling the init function with a valid application token. Thus, a typical use of the pushover module looks like this:

from pushover import init, Client

init("<token>")
Client("<user-key>").send_message("Hello!", title="Hello")

You can also pass the api_token optional argument to Client to initialize the module at the same time:

from pushover import Client

client = Client("<user-key>", api_token="<api-token>")
client.send_message("Hello!", title="Hello")

Attachments can be sent with the attachment parameter which takes as argument as file object:

with open('/path/to/my/image.png', 'rb') as image:
    client.send_message('Message with image', attachment=image)

Command line

python-pushover also comes with a command line utility pushover that you can use as follows:

pushover --api-token <api-token> --user-key <user-key> "Hello!"

Use pushover --help to see the list of available options.

Configuration

Both the pushover module and the pushover command line utility support reading arguments from a configuration file.

The most basic configuration file looks like this:

[Default]
api_token=aaaaaa
user_key=xxxxxx

You can have additional sections and specify a device as well:

[Sam-iPhone]
api_token=bbbbbb
user_key=yyyyyy
device=iPhone

python-pushover will attempt to read the configuration from ~/.pushoverrc by default. The section to read can be specified by using the profile argument. With the configuration file above, you can send a message by simply doing:

from pushover import Client

Client().send_message("Hello!", title="Hello")

or pushover --title "Hello" "Hello!" from the command line.

API

You can access the full API documentation here.

Contributors

Changes

0.4 (2018-05-13)

  • Add support for expire and retry parameters to the command line for priority=2 messages

  • Add support for attachments

0.3 (2016-12-29)

  • Add support for the Glances API

  • Add a cancel function to MessageRequest objects to cancel high priority messages

  • Add support for html message styling

  • Fix bug in MessageRequest.poll for priority=2 requests

0.2 (2014-08-16)

  • Fix bug when using current timestamp

  • Add a pushover command line utility

  • Add Python 3 support

  • Add configuration file feature

  • Easier and more compact Client class creation

  • Switch to setuptools for easier installation and dependencies handling

0.1 (2013-04-16)

Initial Release

Project details


Release history Release notifications | RSS feed

This version

0.5

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

python_pushover2-0.5-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file python_pushover2-0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for python_pushover2-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 540515ebcbd319302e62b44566fb2803364b24466ece599c543e91c37cfd8532
MD5 c1827567c47fc6130c3b0d16d5d94ae1
BLAKE2b-256 ecf19b4e0ca0f31c79dc98724f2a0a2613d8ad9501d8972c50b9afb8efa22a32

See more details on using hashes here.

Supported by

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