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.
"""
Release files for wolfsoftware.pushover 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wolfsoftware_pushover-0.1.1.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wolfsoftware.pushover-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / wolfsoftware_pushover-0.1.1.tar.gz
| Download URL | wolfsoftware_pushover-0.1.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9da4fb71d93f0eb8dc39c97cfe3358641ee0f8c773360a2384b2796698d0524f
|
|
BLAKE2b-256 checksum How to use checksums |
cd6491cdb6b71d675f49f102dd1be98b080ba8aee4660393b4e3cb263cf5d354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / wolfsoftware.pushover-0.1.1-py3-none-any.whl
| Download URL | wolfsoftware.pushover-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c353d85f8e7ede6f4f96f0493c08b9b5d209828db24e23663d0992eb29efd7c
|
|
BLAKE2b-256 checksum How to use checksums |
fcef74f05a4c74703f938808ff55544ad92cb5acdf401bc6b656568a7d6779c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|