aiontfy
Asynchronous client library for the ntfy pub-sub notification service
📖 Documentation
-
Full Documentation: https://tr4nt0r.github.io/aiontfy
-
Source Code: https://github.com/tr4nt0r/aiontfy
📦 Installation
You can install aiontfy via pip:
pip install aiontfy
🚀 Usage
Basic Examples
"""Publish to a ntfy topic."""
import asyncio
from aiohttp import ClientSession
from aiontfy import Message, Ntfy
async def main() -> None:
async with ClientSession() as session:
ntfy = Ntfy("https://ntfy.sh", session)
message = Message(
topic="aiontfy",
title="Hello",
message="World",
click="https://example.com/",
delay="10s",
priority=3,
tags=["octopus"],
)
print(await ntfy.publish(message))
asyncio.run(main())
"""Subscribe to ntfy topics."""
import asyncio
from aiohttp import ClientSession
from aiontfy import Event, Notification, Ntfy
def callback(message: Notification) -> None:
"""Process notifications callback function."""
if message.event is Event.MESSAGE:
print(message.to_dict())
async def main() -> None:
async with ClientSession() as session:
ntfy = Ntfy("https://ntfy.sh", session)
await ntfy.subscribe(
["aiontfy", "test"], # Subscribe to multiple topics
callback,
priority=[3, 4, 5], # Only subscribe to priority >= 3
)
asyncio.run(main())
For more advanced usage, refer to the documentation.
🛠 Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch.
- Make your changes and commit them.
- Submit a pull request.
Make sure to follow the contributing guidelines.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
❤️ Support
If you find this project useful, consider buying me a coffee ☕ or sponsoring me on GitHub!
Metadata
Release files for aiontfy 0.8.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiontfy-0.8.5.tar.gz | 26.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiontfy-0.8.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.0 kB
Release files / aiontfy-0.8.5.tar.gz
| Download URL | aiontfy-0.8.5.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71e245ea066dc6793f154e5518e2d6754f893ad4604182dfc8b0201d38ad660f
|
|
BLAKE2b-256 checksum How to use checksums |
b2e35f514eb5916c23f217f869a1e459d93563795a14ddacdde0a3a2b0a2661c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
|
Release files / aiontfy-0.8.5-py3-none-any.whl
| Download URL | aiontfy-0.8.5-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f27ffcc56056bfaa2b55c7e997465ea5151016812a843d6eb10c67977f92cf55
|
|
BLAKE2b-256 checksum How to use checksums |
8f7ea87b74aa0da40b700499679c4536efb524e34d2dc4492ffc86a87c1c05de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
Hatch/1.16.5 cpython/3.12.3 HTTPX/0.28.1
|