alerts_msg (v0.2.1)
DESCRIPTION_SHORT
All abilities (mail/telegram) to send alert msgs (threading)
DESCRIPTION_LONG
designed for ...
Features
- send alert msgs:
- threading
License
See the LICENSE file for license rights and limitations (MIT).
Release history
See the HISTORY.md file for release history.
Installation
pip install alerts-msg
Import
from alerts_msg import *
USAGE EXAMPLES
See tests and sourcecode for other examples.
1. example1.py
from alerts_msg import *
class AlertADX(AlertSelect.TELEGRAM_DEF):
pass
AlertADX("hello")
AlertADX("World")
AlertADX.threads_wait_all()
from alerts_msg import *
class SmtpServersMOD(SmtpServers):
EXAMPLE_RU: SmtpAddress = SmtpAddress("smtp.EXAMPLE.ru", 123)
class AlertSmtpMOD(AlertSmtp):
SERVER_SMTP: SmtpAddress = SmtpServersMOD.EXAMPLE_RU
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
AUTH: PrivateAuto = PrivateAuto(_section="AUTH_EMAIL_MOD")
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
RECONNECT_PAUSE: int = 60
RECONNECT_LIMIT: int = 10
TIMEOUT_RATELIMIT: int = 600
RECIPIENT_SPECIAL: str = "my_address_2@mail.ru"
from alerts_msg import *
AlertSmtp(_subj_name="Hello", body="World!")
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
pass
AlertSmtpMOD(_subj_name="Hello", body="World!")
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
pass
class MyMonitor:
ALERT = AlertSmtpMOD
monitor = MyMonitor()
monitor.ALERT("Hello")
{
"TG_ID": {"MyTgID": 1234567890},
"TGBOT_DEF": {
"LINK_ID": "@my_bot_20230916",
"NAME": "my_bot",
"TOKEN": "9876543210xxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
from alerts_msg import *
class MyMonitor:
ALERT = AlertTelegram
monitor = MyMonitor()
monitor.ALERT("Hello")