All abilities (mail/telegram) to send alert msgs (threading)
Reason this release was yanked:
while not used anywhere use new vertion!
Project description
alerts_msg
Features
- send alert msgs
- emails
- telegram
- 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 *
GUIDE
See tests and source for other examples.
AlertSmtp
1. add new server if not exists
from alerts_msg import *
class SmtpServersMOD(SmtpServers):
EXAMPLE_RU: SmtpAddress = SmtpAddress("smtp.EXAMPLE.ru", 123)
class AlertSmtpMOD(AlertSmtp):
SERVER_SMTP: SmtpAddress = SmtpServersMOD.EXAMPLE_RU # or direct =SmtpAddress("smtp.EXAMPLE.ru", 123)
2. change authorisation data (see private_values
for details)
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
AUTH_USER: str = "example@mail.ru"
AUTH_PWD: str = PrivateEnv.get("myCustomPrivateEnvName")
3. change other settings (see source for other not mentioned)
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
TIMEOUT_RECONNECT: int = 60
RECONNECT_LIMIT: int = 10
TIMEOUT_RATELIMIT: int = 600
RECIPIENT: str = "my_address_2@mail.ru"
4. send
- if no mods
from alerts_msg import *
AlertSmtp(subj_suffix="Hello", body="World!")
- with mods
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
pass # changed
AlertSmtpMOD(subj_suffix="Hello", body="World!")
5. using in class with saving alert object
from alerts_msg import *
class AlertSmtpMOD(AlertSmtp):
pass # changed
class MyMonitor:
ALERT = AlertSmtpMOD
monitor = MyMonitor()
monitor.ALERT("Hello")
AlertTelegram
All idea is similar to AlertSmtp.
- add auth data
add pv.json or do smth else (for details see private_values.PrivateJsonTgBotAddress)
{
"MyTgID": 1234567890,
"TGBOT1": {
"LINK_ID": "@my_bot_20230916",
"NAME": "my_bot",
"TOKEN": "9876543210xxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
from alerts_msg import *
class MyMonitor:
ALERT = AlertTelegram
monitor = MyMonitor()
monitor.ALERT("Hello")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
alerts_msg-0.1.1.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file alerts_msg-0.1.1.tar.gz
.
File metadata
- Download URL: alerts_msg-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ae55476bbfa7c9794bca428a7b893c312e4475f36a5e34d9d9b4cb2c375ab0e |
|
MD5 | dd0c7ee8d6cc1f7c8d0c3431a8f7680d |
|
BLAKE2b-256 | 157e4e575babc542e4e8cc7e01fcbde7ffa0e98c3da2827fa89a880b3526da41 |
File details
Details for the file alerts_msg-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: alerts_msg-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98723e0cf1b3b5ee68e3830f52341a0351bd1b46351d7c30c1d7bc87a0058436 |
|
MD5 | 794ed42f11fc28a145919c741bf2fef7 |
|
BLAKE2b-256 | b0f9f79d23af3660b0fbac67b598ca1d1b257a35911c7718060ffa41be6b0f66 |