A Python package for sending notifications via ntfy.sh
Project description
ntfy-notify
Installation
Using pip
pip install ntfy_notify
Using Poetry
poetry add ntfy_notify
Configuration
Create a configuration file at ~/.config/ntfy-notify/config.toml with your ntfy.sh credentials:
# Required: Your ntfy.sh server URL
server = "https://ntfy.sh"
# Required: Your access token (if using ntfy.sh with authentication)
token = "your_token_here"
# Required: Default topic to send notifications to
default_topic = "your_topic_here"
# Optional: Default message priority (default: "default")
# Valid values: "min", "low", "default", "high", "max"
default_priority = "default"
Usage
Python API
import ntfy_notify
# Basic notification
ntfy_notify.send_notification("Hello from Python!")
# With title and priority
ntfy_notify.send_notification(
"This is an important message",
title="Important Update",
priority="high"
)
# With custom topic
ntfy_notify.send_notification("This goes to a custom topic", topic="custom_topic")
# With additional options
ntfy_notify.send_notification(
"Check out our website!",
title="Website",
click_url="https://example.com",
tags=["globe_with_meridians", "link"]
)
Command Line Interface
# Basic usage
ntfy_notify "Hello from the command line!"
# With options
ntfy_notify -m "Important message" -t mytopic --title "Alert" --priority high
# With clickable URL
ntfy_notify -m "Check out our website!" --click-url https://example.com
# With tags
ntfy_notify -m "Server down!" --tags warning,skull
Command Line Options
Usage: ntfy-notify [OPTIONS] [MESSAGE]
Send a notification via ntfy.sh
If MESSAGE is not provided, reads from stdin.
Options:
-m, --message TEXT The message to send (required if not reading from
stdin)
-t, --topic TEXT Topic to send to (overrides config)
--title TEXT Message title
-p, --priority [min|low|default|high|max]
Message priority
--click-url TEXT URL to open when notification is clicked
--tags TEXT Comma-separated list of tags/emojis
--config FILE Path to config file
--version Show the version and exit.
--help Show this message and exit.
License
This project is licensed under the EUPL-1.2 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Running Tests
The test suite uses pytest and can be run with:
# Install test dependencies
poetry install --with test
# Run tests
poetry run pytest -v tests/
Development
- Clone the repository
- Install dependencies:
poetry install - Create a test configuration file at
~/.config/ntfy-notify/config.toml - Run tests to verify your setup
License
EUPL-1.2
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ntfy_notify-0.1.2.tar.gz.
File metadata
- Download URL: ntfy_notify-0.1.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f711320a802e8b18155e4ff06cbcb06e27c91370889da96db6021e5165bc49e
|
|
| MD5 |
6a0a9de1f22c1fa96d9265d2f1549038
|
|
| BLAKE2b-256 |
80c7daa260f58f0829db1f3a7e1c95ac52491745915f0bc0841406552512c1b8
|
File details
Details for the file ntfy_notify-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ntfy_notify-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26b815e713f8c74cb1fb4683ccc239ef8c5cda76307da95af32cfc0a68869c19
|
|
| MD5 |
29b0f579b78d884b0633331411f5dae2
|
|
| BLAKE2b-256 |
d832125d5b0f2a60e4003bc5043ecb38d856851b8a40c95a0858a1be17ea10d9
|