alertist
Alertist is a library that makes it as easy as possible to send a message to a target, without rewriting code. All configuration happens via environment variables.
Motivation
Sending alerts just needs to be easy. Code shouldn't need rewriting so that you can change the destination for a message, a deployment shouldn't have to happen, and CI changed just to send an email, when an SNS message will do. Enter alertist.
Alertist makes is simple to send alerts. Configure environment variables, and run your python application. But maybe that doesn't work for you - alertist loads a .env by default, from your current working directory, making it as painless as possible to trigger alert sending, without application overhead.
Installation
pip install alertist
Usage
Create an alertist object, and call the alert method with the target and message. The alertist object, must be instantiated with the target, or alert type you'd like to send.
from alertist import Alertist
from alertist.targets import Pushover
a = Alertist(Pushover)
a.alert("Hello, world!")
If you'd like to send a message asynchronously, you use the exact same code, except that the alert method is now called aalert, and must be awaited.
from alertist import Alertist
from alertist.targets import Pushover
a = Alertist(Pushover)
await a.alert("Hello, world!")
Supported alert types can be found in the targets folder.
Contributing
Writing a new alert target
Bug, features, or integrations? Feel free to contribute in whatever way you can! But below, let's highlight how to create a new alert target.
- Create a new class subclassing
ABCTarget - Implement the synchronous
alertmethod, and asynchronousaalertmethod - Add all environment variables that can be configured to
CONFIG_KEYSin your class. - Add your class to
targets.__all__in__init__.py - Write two unit tests, probably mocking your connecting.
Metadata
Release files for alertist 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alertist-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alertist-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / alertist-0.1.0.tar.gz
| Download URL | alertist-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9819efe66a7aa0a2b34c748f3a7564fee7be59beae8584602616b0639d43ce6d
|
|
BLAKE2b-256 checksum How to use checksums |
c9d285df15c2c96eb11ce7a9843d51abd09f9229568d7d0325b4cb9857afd152
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / alertist-0.1.0-py3-none-any.whl
| Download URL | alertist-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f3ba2d045c08ebaf9305fc0b5cb2902c1218b030867ca223d976555a3d733fa
|
|
BLAKE2b-256 checksum How to use checksums |
c25455a7ba97bf501127216f33f2ce2dd61c0ba1c1dec2598d0272d6e0aff20c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|