An ntfy library aiming for feature completeness
Project description
A Python Library For ntfy.sh
An easy-to-use ntfy python library. Aiming for full feature support.
Quickstart
- Install using pip with
pip3 install python-ntfy
- Configure the following environment variables:
NTFY_USER
: The username for your server (if required)NTFY_PASSWORD
: The password for your server (if required)NTFY_SERVER
: The server URL (defaults tohttps://ntft.sh
)
- Setup your application to use the library:
# Import the ntfy client
from python_ntfy import NtfyClient
# Create an `NtfyClient` instance with a topic
client = NtfyClient(topic="Your topic")
# Send a message
client.send("Your message here")
See the full documentation site at https://matthewcane.github.io/python-ntfy/.
Supported Features
- Username + password auth
- Custom servers
- Sending plaintext messages
- Sending Markdown formatted text messages
- Retrieving cached messages
- Scheduled delivery
- Tags
- Action buttons
Future Features
- Access token auth
- Email notifications
- Send to multiple topics at once
Test and Development
This project uses:
- Poetry as it's dependency manager
- Ruff for linting and code formatting
To install dev dependencies, run poetry install --with dev
.
Linting and Formatting
These can be run with:
poetry run ruff format
poetry run ruff check
Tests
This project is aiming for 95% code coverage. Any added features must include comprihensive tests.
You can run the tests against a local instance of ntfy
or ntfy.sh
.
Setup Steps
- To test against a local
ntfy
instance: i. Create a container usingdocker run -p 80:80 -it binwiederhier/ntfy serve --attachment-cache-dir=/cache --base-url=http://localhost
ii. Set the following key in the.env
file:NTFY_SERVER=http://localhost
iii. Add a dummy username and password to.env
(see example.env) - To test against https://ntfy.sh:
i. Add username and password for ntfy.sh to
.env
(see example.env) - Run the tests with
poetry run pytest --cov
The tests will sent messages to the python_ntfy_testing
topic so you will need to subcribe to that topic to see the test messages.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file python_ntfy-0.2.3.tar.gz
.
File metadata
- Download URL: python_ntfy-0.2.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1789f25ac3c5346b3de6d800c0c9b45931a1a418380c867f5f4f5b3b2660fc1 |
|
MD5 | baf859793bbef6eab1b2c3de6f162a5c |
|
BLAKE2b-256 | 6b75ff5800207ba462a1055b0735d86111d10607c65aa1c1c18140612798b683 |
File details
Details for the file python_ntfy-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: python_ntfy-0.2.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 397757e6547084d2a325851ef53f65767444a313d97f5abe2311ba8a93e665f0 |
|
MD5 | 921427007d7dfedcb969064eb575e050 |
|
BLAKE2b-256 | 8733ff4b3bc7dff86aad7d0b795b14972012532cec982a53d5c5c3d557f1a6b3 |