Skip to main content

ix-notifiers

A python library for sending one notification to several services at once.

Install

pip install ix-notifiers

Usage

Build a core, register the notifiers you want, then send. notify() returns True when at least one channel accepted the notification.

from ix_notifiers import IxNotifiers

notifiers = IxNotifiers()

# Each keyword is prefixed with the name of the notifier it belongs to. The prefix is
# stripped before the notifier sees it, so `gotify_token` arrives as `token`.
notifiers.register(
    "gotify",
    gotify_url="https://gotify.example.com",
    gotify_token="your-application-token",
    gotify_default_priority=5,
)
notifiers.register("null")

notifiers.notify(title="Deploy", message="finished")

Every core holds its own registry, so two cores in one process do not see each other's notifiers. Registering a name no notifier answers to logs a warning and registers nothing.

Notifiers

Discovery is by filename: every *_notifier.py in the package is available under the name in front of _notifier.

gotify

Posts to a Gotify server's /message endpoint.

Parameter Mandatory Default Description
gotify_url yes - base URL of the Gotify server
gotify_token yes - application token, kept out of the logs
gotify_content_type no text/markdown content type of the message body
gotify_default_priority no 0 priority for messages that carry none

send() accepts title, message, priority and content_type. A field that is not given is left out of the request, and content_type overrides the default for that one message. A priority that will not convert to an integer is logged and the message is sent without one.

null

Logs the notification at info level and reports success. Useful for a dry run.

Writing a notifier

Add a <name>_notifier.py to the package with a Notifier subclass, a params declaration and a module-level start:

from typing import Any, ClassVar

from .notifier import Notifier


class WebhookNotifier(Notifier):
    """Posts a notification to a webhook."""

    params: ClassVar[dict[str, dict[str, Any]]] = {
        "url": {"mandatory": True, "type": "string"},
        "secret": {"mandatory": True, "redact": True, "type": "string"},
        "timeout": {"default": 10, "type": "integer"},
    }

    def send(self, **kwargs: Any) -> bool:
        """Sends the notification and reports whether it was accepted."""
        ...


start = WebhookNotifier.start

Each parameter declares a type of boolean, integer or string, and optionally mandatory, default and redact. The base class resolves them into self.settings:

  • a mandatory parameter has to be present, and a supplied 0, False or "" counts as present
  • an optional parameter falls back to its default, or to None where it declares none
  • a value of the wrong declared type is rejected, and an integer parameter rejects a boolean
  • a parameter marked redact has its value masked out of anything the notifier logs through self.redact()

Logging

Every module logs to the ix-notifiers logger and attaches no handler of its own, so the application decides where the records go.

Contributing

See CONTRIBUTING.md. Every change has to pass ruff check, ruff format --check, pylint and the test suite at 100% statement and branch coverage.

Metadata

Release files for ix-notifiers 2.0.0

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

Source distribution (sdist)

Source distribution for ix-notifiers 2.0.0
File Size Uploaded
ix_notifiers-2.0.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ix-notifiers 2.0.0
File Interpreter ABI Platform
ix_notifiers-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / ix_notifiers-2.0.0.tar.gz

Download URL ix_notifiers-2.0.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
22147dadb57bd2ac3358e927ff41568462819b719d8a765fb5b6fe558b81484a
BLAKE2b-256 checksum
How to use checksums
aead856de5a1a3a2ddc0bea52a5a022f499479655f00c8e533fac0ed0d200fcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.14.5 Linux/7.0.0-28-generic

Release files / ix_notifiers-2.0.0-py3-none-any.whl

Download URL ix_notifiers-2.0.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff5e7e5c40e05c37f3d44f4872f67dc1ca5895d6efd0f319235ac6d85a1e825
BLAKE2b-256 checksum
How to use checksums
2ffa6c29531f1c50c8ca463b04a79221b3e55ed1d9d664a9ff75292e6e3c199d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.14.5 Linux/7.0.0-28-generic

Release history Release notifications | RSS feed

2.0.23

2 release files

2.0.22

2 release files

2.0.19

2 release files

2.0.18

2 release files

2.0.17

2 release files

2.0.16

2 release files

2.0.15

2 release files

2.0.14

2 release files

2.0.13

2 release files

2.0.10

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

This release

2.0.0 This release

2 release files

1.0.41

2 release files

1.0.40

2 release files

1.0.39

2 release files

1.0.37

2 release files

1.0.36

2 release files

1.0.35

2 release files

1.0.32

2 release files

1.0.31

2 release files

1.0.30

2 release files

1.0.29

2 release files

1.0.28

2 release files

1.0.27

2 release files

1.0.26

2 release files

1.0.25

2 release files

1.0.24

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.24

1 release file

0.5.23

1 release file

0.5.22

1 release file

0.5.21

1 release file

0.5.20

1 release file

0.5.19

1 release file

0.5.18

1 release file

0.5.17

1 release file

0.5.16

1 release file

0.5.15

1 release file

0.5.14

1 release file

0.5.13

1 release file

0.5.12

1 release file

0.5.11

1 release file

0.5.10

1 release file

0.5.9

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

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