Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

aiontfy

Asynchronous client library for the ntfy pub-sub notification service

build codecov Spectra Assure Community Badge PyPI version PyPI - Downloads GitHub Sponsor


📖 Documentation


📦 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:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes and commit them.
  4. 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.6rc0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiontfy 0.8.6rc0
File Size Uploaded
aiontfy-0.8.6rc0.tar.gz 26.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiontfy 0.8.6rc0
File Interpreter ABI Platform
aiontfy-0.8.6rc0-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / aiontfy-0.8.6rc0.tar.gz

Download URL aiontfy-0.8.6rc0.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
88b329d65eb02850b0fb7ba8335f6b2c2456064dd2a308e14bf8e52c0dcd0cdb
BLAKE2b-256 checksum
How to use checksums
8d03e634c9a8f852efde0caa7c15e91f08a9bdb40e2e0c3319ea2df2baab0e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via Hatch/1.18.0 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.10.0

Release files / aiontfy-0.8.6rc0-py3-none-any.whl

Download URL aiontfy-0.8.6rc0-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0e471c6f3501cd25187fa05edfd012a8ea8aba7e9beb171fc9c34f07cd766ca
BLAKE2b-256 checksum
How to use checksums
68712e52a5c5499e9f88ea5f69bc81736621717f076f4f85f343500d36722986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via Hatch/1.18.0 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.12.3"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.10.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page