Skip to main content

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

  1. send alert msgs
    • emails
    • telegram
  2. 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: PrivateJsonAuth = PrivateJsonAuth().get_section("AUTH_EMAIL_MOD")

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,
    "TGBOTDEF": {
        "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


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.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

alerts_msg-0.1.5-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file alerts_msg-0.1.5.tar.gz.

File metadata

  • Download URL: alerts_msg-0.1.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for alerts_msg-0.1.5.tar.gz
Algorithm Hash digest
SHA256 a9ad408e81bcf224e491b111024cc5eca168a482e4a0ab552d035a86aab01a9f
MD5 b0ddaafe74421d60966bf0f6ca5322f5
BLAKE2b-256 41b98fff9cb938dc6b615eb4bca16b893f0cdec1c3a60eb881fe7808140ba3c1

See more details on using hashes here.

File details

Details for the file alerts_msg-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: alerts_msg-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for alerts_msg-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b46fb49c34234ccbe3e2145e9e5f2cb5fb38e24c484ed0749c2379a833b76f31
MD5 6c724fa68ca8df4a06379db84901f9d8
BLAKE2b-256 d39566f14013f2238e9339847c72b1a87fc6b578448dc431b916ccf52428161d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page