Async ntfy client library
Project description
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."""
from aiohttp import ClientSession
from aiontfy import Message, Ntfy
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))
"""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](https://tr4nt0r.github.io/pynecil).
🛠 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!
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
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 aiontfy-0.5.2.tar.gz.
File metadata
- Download URL: aiontfy-0.5.2.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b2c990af3c8e8abe90b7b905cfc0ba8d3a7dcb4ea240f249da93abebb5addf8
|
|
| MD5 |
c0158ace919f98f14ae08e113960529f
|
|
| BLAKE2b-256 |
0712b7b2b9a8c365378f2a5bc373dd762aefe552aed6ef2e1c85f17e1f5fa630
|
File details
Details for the file aiontfy-0.5.2-py3-none-any.whl.
File metadata
- Download URL: aiontfy-0.5.2-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16604f54a0ddc3f884b8d4284a36c5e60138940c0947f3f054fcf21fa222dcde
|
|
| MD5 |
0ec6718124b769b191a8ed41dbb239d1
|
|
| BLAKE2b-256 |
39ee117497346e9007978784bbd5c1cbf19f07fd8893c0eb08a2cc6dc69f996c
|