catchexception-0.1.0
توضیحات
With Python's try-except statement, experience a significantly more flexible way to receive notifications.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | catchexception-0.1.0 |
| نام | catchexception |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | parkminwoo |
| ایمیل نویسنده | parkminwoo1991@gmail.com |
| آدرس صفحه اصلی | https://github.com/dsdanielpark/CatchException |
| آدرس اینترنتی | https://pypi.org/project/catchexception/ |
| مجوز | - |
# Python: CatchException
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 [`CatchException`](https://github.com/dsdanielpark/CatchException) can give a single line alarm with an error message, whereas [`knockknock`](https://github.com/huggingface/knockknock) gives a process ending alarm with decorator and cli.
<br>
# Quick Start
CatchException installation
```
pip insall catchexception
```
<br>
# Features
### `Mail`
In the except statement, an email is sent along with the error message. Additionally, you can send emails from any desired line. <br><br>
a. Log in with the sender's email ID. <br>
b. Obtain an app password for sending Google Mail at the following [link](https://myaccount.google.com/u/3/apppasswords?utm_source=google-account&utm_medium=myaccountsecurity&utm_campaign=tsv-settings&rapt=AEjHL4N2bMRWO46VaMp_jP06zQK14BWNPv66l2o59iJ99CkO8BjYnmoRUe9dtSchkkbubHZMUhevkAnwVJRHb9ygO3afispNlw).
```python
from CatchException import ExceptionMail, SuccessMail, SendMail
sys.excepthook = ExceptionMail.__call__
try:
main() # Your Code Here
SuccessMail().__call__() # No Exception -> Send Success mail.
except ExceptionMail: # Exception -> Send Fail mail.
pass
SendMail().__call__() # When Process Ended -> Any Line mail.
```
<details>
<summary> See Example...</summary>
```python
import sys
from CatchException import ExceptionMail, 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 = ExceptionMail.__call__
try:
# 02. Locate your code.
print(1/0)
SuccessMail().__call__() # Success Mail
# Exception Mail
except ExceptionMail as e:
sys.exit()
print(e)
SendMail().__call__() # Put Any Line: Sending mail
```
</details>
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl catchexception-0.1.0:
pip install catchexception-0.1.0.whl
نصب پکیج tar.gz catchexception-0.1.0:
pip install catchexception-0.1.0.tar.gz