Skip to main content

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 sponsoring me on GitHub!

Metadata

Release files for aiontfy 0.8.6

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.6
File Size Uploaded Provenance Actions
aiontfy-0.8.6.tar.gz 26.7 kB Without provenance Details for aiontfy-0.8.6.tar.gz

Built distribution (wheel)

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

Total release size: 42.1 kB

Release files / aiontfy-0.8.6.tar.gz

Download URL aiontfy-0.8.6.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
db4a55c61c233be64dce8a3ef21fa8a1a00ee0147fbb7639037fe0a339b18187
BLAKE2b-256 checksum
How to use checksums
4e188aca4706df0529f797d9c87b04a352f80df82ccd43d8b87fa53ba68d10af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via Hatch/1.18.1 {"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.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.0

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

Download URL aiontfy-0.8.6-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52a64fe2cae58a81eb539b5628936f86ea1975d2cbb76abc549b590570fa056e
BLAKE2b-256 checksum
How to use checksums
2c0ae87c2a0d0e0d12d4ce72eb1b717744f299b35e447d38c513a68326dd9e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via Hatch/1.18.1 {"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.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.12.3","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.13.0

Security for aiontfy 0.8.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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