With Python's try-except statement, experience a significantly more flexible way to receive notifications.
Project description
Python: ExceptionNotifier
With Python's try-except statement, experience a significantly more flexible way to receive notifications. You can receive alerts through various messaging platforms such as email, Slack, and Discord. This package offers an extensive range of notification options to suit your needs.
Python package ExceptionNotifier
can give a single line alarm with an error message, whereas knockknock
gives a process ending alarm with decorator and cli.
Quick Start
ExceptionNotifier installation
pip insall ExceptionNotifier
Features
Mail
In the except statement, an email is sent along with the error message. Additionally, you can send emails from any desired line.
a. Log in with the sender's email ID.
b. Obtain an app password for sending Google Mail at the following link.
from ExceptionNotifier import ExceptMail, SuccessMail, SendMail
sys.excepthook = ExceptMail.__call__
try:
main() # Your Code Here
SuccessMail().__call__() # No Exception -> Send Success mail.
except ExceptMail: # Exception -> Send Fail mail.
pass
SendMail().__call__() # When Process Ended -> Any Line mail.
See Example...
import sys
from ExceptionNotifier import ExceptMail, SuccessMail
# 01. Set variable.
global gmail_receiver, gmail_sender, gmail_app_password_of_sender, SendMail
gmail_receiver = 'parkminwoo1991@gmail.com'
gmail_sender = 'heydudenotice@gmail.com'
gmail_app_password_of_sender = 'xxxxxxxxxxx'
sys.excepthook = ExceptMail.__call__
try:
# 02. Locate your code.
print(1/0)
SuccessMail().__call__() # Success Mail
# Exception Mail
except ExceptMail as e:
sys.exit()
print(e)
SendMail().__call__() # Put Any Line: Sending mail
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
Built Distribution
Hashes for ExceptNotifier-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2315711f98f6e70e6d6bdf367266ffa1b20ea62199fc9e6b4f4d4912cf9dc39 |
|
MD5 | 6c58804872ce12d5c731b140686568de |
|
BLAKE2b-256 | bdc0183b3bb55e41c82dac5b560ba9f9ac24a37e6dc6c6b3351305785e2a563c |