An ntfy library aiming for feature completeness
Project description
A Python Library For ntfy
An easy-to-use python library for the ntfy notification service. Aiming for full feature support and a super easy to use interface.
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
- Access token auth
- Custom servers
- Sending plaintext messages
- Sending Markdown formatted text messages
- Retrieving cached messages
- Scheduled delivery
- Tags
- Action buttons
Future Features
- Email notifications
- Send to multiple topics at once
Testing and Development
This project uses:
- Poetry as it's dependency manager
- Ruff for linting and code formatting
- MyPy for static type checking
- Pre-Commit for running the above tools before committing
To install dev dependencies, run poetry install --with dev
.
To install pre-commit hooks, run pre-commit install
.
Linting, Formatting and Type Checking
These can be run with:
poetry run ruff format
poetry run ruff check
poetry run mypy .
These tools are also run in the CI pipeline and must pass before merging.
Tests
This project is aiming for 95% code coverage. Any added features must include comprihensive tests.
Setup Steps
- Start the test docker container with
docker-compose -f tests/assets/test_containers.yml up
- Run the tests with
poetry run pytest --cov
The tests will sent messages to the python_ntfy_testing
topic so you will need to view the web interface and 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.3.8.tar.gz
.
File metadata
- Download URL: python_ntfy-0.3.8.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cb3c87ad509d988632ce02f153e2845f9b62b010a7add188026bbbd1cf51f7e |
|
MD5 | 66e21ff98ef381871999d915ae5f3182 |
|
BLAKE2b-256 | e723936c0e09b5b527cbc3cbe1fdb36440093ee71f2d393f2961eaf646d7aeb3 |
File details
Details for the file python_ntfy-0.3.8-py3-none-any.whl
.
File metadata
- Download URL: python_ntfy-0.3.8-py3-none-any.whl
- Upload date:
- Size: 6.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 | 412cd59461cfcebca9b53858075f667bcb43372af63dd78734e03191c688eb33 |
|
MD5 | 8c5163900e7a6fada5de0b5f753dac80 |
|
BLAKE2b-256 | b399a433ddc30eb1a2d54ecd88777400de65891c1712e86906f858b297c0641e |