Skip to main content

A package for sending messages via Pushover.

Project description

NotificationsToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This project provides a Python interface to the Pushover API, allowing you to send notifications through the Pushover service. The package supports sending messages, emergency messages, and group messages, as well as listing available sounds.

Installation

To install the package, you can use pip:

pip install wolfsoftware.pushover

Usage

Here's a basic example of how to use the Pushover package:

from wolfsoftware.pushover import Pushover

# Initialize the Pushover instance
pushover = Pushover(user_key='your_user_key', api_token='your_api_token')

# Send a message
try:
    response = pushover.send_message(message='Hello, this is a test message!')
    print(response)
except PushoverException as e:
    print(str(e))

API

Pushover Class

The Pushover class provides methods to interact with the Pushover API.

Initialization

pushover = Pushover(user_key='your_user_key', api_token='your_api_token')

Methods

send_message

Sends a message through Pushover.

def send_message(message: str, title: Optional[str] = None, url: Optional[str] = None, url_title: Optional[str] = None, priority: Optional[int] = 0, sound: Optional[str] = None, device: Optional[str] = None, attachment: Optional[str] = None) -> dict:
    """
    Send a message using the Pushover API.

    Arguments:
        message (str): The message content.
        title (str, optional): The message title.
        url (str, optional): A supplementary URL to show with the message.
        url_title (str, optional): A title for the supplementary URL.
        priority (int, optional): The priority of the message.
        sound (str, optional): The name of the sound to play with the message.
        device (str, optional): The device name to send the message to.
        attachment (str, optional): Path to an attachment file.

    Returns:
        dict: The response from the Pushover API.

    Raises:
        PushoverException: If the request to the Pushover API fails.
    """

send_emergency_message

Sends an emergency message through Pushover.

def send_emergency_message(message: str, title: Optional[str] = None, url: Optional[str] = None, url_title: Optional[str] = None, retry: Optional[int] = 30, expire: Optional[int] = 3600, sound: Optional[str] = None, device: Optional[str] = None) -> Dict:
    """
    Send an emergency message using the Pushover API.

    Arguments:
        message (str): The message content.
        title (str, optional): The message title.
        url (str, optional): A supplementary URL to show with the message.
        url_title (str, optional): A title for the supplementary URL.
        retry (int, optional): How often (in seconds) to retry the message.
        expire (int, optional): How long (in seconds) before the message expires.
        sound (str, optional): The name of the sound to play with the message.
        device (str, optional): The device name to send the message to.

    Returns:
        dict: The response from the Pushover API.

    Raises:
        PushoverException: If the request to the Pushover API fails.
    """

send_group_message

Sends a message to a group through Pushover.

def send_group_message(message: str, group_key: str, title: Optional[str] = None, url: Optional[str] = None, url_title: Optional[str] = None, priority: Optional[int] = 0, sound: Optional[str] = None, device: Optional[str] = None, attachment: Optional[str] = None) -> Dict:
    """
    Send a message to a group using the Pushover API.

    Arguments:
        message (str): The message content.
        group_key (str): The Pushover group key.
        title (str, optional): The message title.
        url (str, optional): A supplementary URL to show with the message.
        url_title (str, optional): A title for the supplementary URL.
        priority (int, optional): The priority of the message.
        sound (str, optional): The name of the sound to play with the message.
        device (str, optional): The device name to send the message to.
        attachment (str, optional): Path to an attachment file.

    Returns:
        dict: The response from the Pushover API.

    Raises:
        PushoverException: If the request to the Pushover API fails.
    """

list_sounds

Lists available sounds.

def list_sounds(self) -> dict:
    """
    List the available sounds from the Pushover API.

    Returns:
        dict: The response from the Pushover API.

    Raises:
        PushoverException: If the request to the Pushover API fails.
    """

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

wolfsoftware_pushover-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

wolfsoftware.pushover-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file wolfsoftware_pushover-0.1.1.tar.gz.

File metadata

  • Download URL: wolfsoftware_pushover-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for wolfsoftware_pushover-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9da4fb71d93f0eb8dc39c97cfe3358641ee0f8c773360a2384b2796698d0524f
MD5 251af7047e32b762fffe049bd9d857f3
BLAKE2b-256 cd6491cdb6b71d675f49f102dd1be98b080ba8aee4660393b4e3cb263cf5d354

See more details on using hashes here.

File details

Details for the file wolfsoftware.pushover-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wolfsoftware.pushover-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c353d85f8e7ede6f4f96f0493c08b9b5d209828db24e23663d0992eb29efd7c
MD5 0feec0229c8666cb68c408862e559a02
BLAKE2b-256 fcef74f05a4c74703f938808ff55544ad92cb5acdf401bc6b656568a7d6779c0

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