Skip to main content

A simple and easy to use package to help send push notifications via pushover.net.

Project description

PushOver Push Notification API Module

A single Python Module that allows for the interaction with PushOver's Push Notification API. PushOver offers a service that makes it really easy to send Push Notification to devices (laptops, phones, etc). This is all accomplished easily through the use of POST Requests to their API Endpoint. This module just takes the easy to use service and wraps it up in a nice and quick way to allow for quicker script writing.

Set up:

  1. Get an account at: https://pushover.net/ (This is the "Dashboard" URL once signed in)
  2. Copy example.env and rename it to .env
  3. Grab the "User Key" and add it to the designated place (USER_KEY) in the .env, found in the root of the project directory (pushover/)
  4. Next create your application through: https://pushover.net/apps/build
  5. Grab the "API Token/Key" (we'll call it a "API Token" because the POST calls it a Token so therefore it is a TOKEN). Add the API Token to the designated place (API_TOKEN) in the .env
  6. Finally run: pip install -r requirements.txt
  7. DON'T FORGET TO ADD A DEVICE AND INSTALL THE APP ON YOUR PHONE OR HAVE THE BROWSER REGISTERED! This can be done through the Dashboard.

Usage and Limitations:

Once you have completed the set up, you should be ready to use the module. There are some limitations the PushOver Push Notification API. These limitations are actually also handled within the python module itself, as validation, to help avoid users of this module from wasting API Calls and wasting their time. Before using the module make sure to give a quick glance to the limitations: https://pushover.net/api#limits.

None of the limitations are particularly major. Mainly max length restrictions on URLs and Text, and then Byte Size limits on Images.

Usage

from simple_pushover import PushoverAPI

# first create a PushoverAPI instance
api = PushoverAPI()
# To send a message (under 1024 Characters...) You can use the simple_send_push or the more featureful send_push.
# Really only the message kwarg is required.
api.simple_send_push(message="Hello World")

# You can also add the priority kwarg to set the priority level (-2 thru 2). I.E. priority=1 sends a message with a High Priority. It should be noted that the default is 0 which is normal priority
api.simple_send_push(message="Hello World", priority=1)

# For more complex Push notifications you can use:
api.send_push(
    title="Test Title",
    message="This is an example of a more complex push notification.",
    url="https://example.com/",
    url_title="Link Display Title",
    attachment="path/to_img.png",
    priority=1
)
# Once again the only required kwarg is message. However If you pass the kwarg url_title, you must also pass a URL.

Future Enhancements:

I may add some other minor pieces to the module to help with other APIs that PushOver offers ( maybe once I have a need for them :^) ). The Push Notification still has some touch ups needed which can be found below...

TO DO:

  • Add filetype validation to the image attachments... Technically their API only handles images as attachments according to their API. I forgot to add that check, DOH!
  • Add HTML parsing options

Project details


Download files

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

Source Distribution

simple_pushover-0.0.5.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

simple_pushover-0.0.5-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file simple_pushover-0.0.5.tar.gz.

File metadata

  • Download URL: simple_pushover-0.0.5.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for simple_pushover-0.0.5.tar.gz
Algorithm Hash digest
SHA256 0ef3e1dac56f722cb4f820bd0a52bfe9105c7aeb843c5e287b0c6314f4b56a2e
MD5 83a7fc62c2d119185ff30a46e0368720
BLAKE2b-256 7cbd33c8dfcd7e69fb2e419718d64804327b315ec661e8bbb91e56c1a13615be

See more details on using hashes here.

File details

Details for the file simple_pushover-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_pushover-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6098c8ea495b29d0d37322b284aecc1dbe933da84d31f3f07a349b77ecf6dc30
MD5 7b5bc538608b264975febef94cdbc892
BLAKE2b-256 39ea798be3a384416ea57469451832b43c686321e5686387206e2186e18634ee

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