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!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiontfy-0.8.6rc0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiontfy-0.8.6rc0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file aiontfy-0.8.6rc0.tar.gz.

File metadata

  • Download URL: aiontfy-0.8.6rc0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for aiontfy-0.8.6rc0.tar.gz
Algorithm Hash digest
SHA256 88b329d65eb02850b0fb7ba8335f6b2c2456064dd2a308e14bf8e52c0dcd0cdb
MD5 a54821cbabda5eef90630983736526c3
BLAKE2b-256 8d03e634c9a8f852efde0caa7c15e91f08a9bdb40e2e0c3319ea2df2baab0e20

See more details on using hashes here.

File details

Details for the file aiontfy-0.8.6rc0-py3-none-any.whl.

File metadata

  • Download URL: aiontfy-0.8.6rc0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for aiontfy-0.8.6rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0e471c6f3501cd25187fa05edfd012a8ea8aba7e9beb171fc9c34f07cd766ca
MD5 a377a25f7c2bdea0d4b16cc3a2ccab4b
BLAKE2b-256 68712e52a5c5499e9f88ea5f69bc81736621717f076f4f85f343500d36722986

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.6rc0 This release

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

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