Notifiers is a Python library that provides a unified and simple interface for sending notifications through various providers like Pushover, Slack, Email, and Telegram. It aims to simplify the process of integrating notifications into applications and scripts without needing to implement individual provider APIs. The current version is 1.3.6, with releases occurring periodically, focusing on new provider additions, bug fixes, and maintenance.
pip install notifiersVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to send a notification using the 'pushover' provider. It fetches credentials from environment variables (or placeholders) and uses the `get_notifier` function. It also explicitly sets `raise_on_errors=True` for robust error handling.
Migrate to a different notification provider supported by Notifiers (e.g., Slack, Telegram) and update your code accordingly. Consider using version <1.3.0 if HipChat support is critical and migration is not feasible.
Review the documentation for your specific provider and CLI usage. Ensure all required arguments are passed to resource calls and adapt CLI commands to the new option-based syntax. For Python API, `get_notifier` remains the entry point, but subsequent calls to provider-specific resources might require additional arguments.
Always check the `notifier.required` or `notifier.schema` properties for a given provider to understand the expected arguments and their types. Ensure all mandatory parameters are passed to the `notify` method.
For reliable error handling, always use `raise_on_errors=True` in your `notify()` calls or explicitly check `response.ok` and `response.errors` after sending a notification.
Install the library using pip: `pip install notifiers`
Check the `notifier.required` property for the specific provider to see which arguments are needed, and then provide them in the `notify()` call. Example: `pushover.notify(user='your_user_key', token='your_app_token', message='Hello from Notifiers!')`
Verify the provider name against the list of supported providers. You can get a list of available providers using `notifiers.get_notifier.providers()`. Correct the provider name in your code, for example: `from notifiers import get_notifier; p = get_notifier('pushover')`