A program error or completion email notification tool.
Project description
Errome
Errome 是一个 Python 库,旨在为 Python 应用程序提供一个简单的方式来发送运行状态通知邮件。无论程序运行成功或遇到错误,Errome 都能自动发送包含运行时间和错误信息(如有)的邮件给指定的接收者。
功能
- 监控函数的执行时间
- 在函数成功执行后发送运行成功的邮件通知
- 捕获函数运行时的异常,并发送包含错误信息的邮件通知
示例:
安装
通过克隆 GitHub 仓库的方式安装 Errome:
git clone https://github.com/Becomingw/Errome.git
cd Errome
pip install .
快速开始
首先,确保你有一个可以发送邮件的 SMTP 服务器。目前仅支持smtp.163.com(网易邮箱)。
创建一个 Errome 实例:
from Errome.Errome import Errome
#### 初始化邮件发送器
email_sender = Errome(sender_email="your_email@example.com",
password="your_password",
receiver="receiver_email@example.com")
使用 @email_sender.notify 装饰器来监控你的函数:
@email_sender.notify
def my_function():
# Your function code here
print("This function does something.")
运行你的函数:
my_function()
当 my_function 执行完成,你会收到一封邮件通知。如果函数执行过程中出现异常,邮件中将包含错误信息。
也可以不使用修饰器,
在一段程序开始运行时:
email_sender.set_start()
然后后续使用email_sender.send_email(statu)来发送邮件。
配置
- sender_email: 发件人邮箱地址。
- password: 发件人邮箱的密码或应用密码(具体来说是邮箱的secret_token)。
- receiver: 邮件接收者的邮箱地址。
To DO:
- 接入GPT对错误信息进行解释
- 支持更多邮箱及自定义邮箱
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Errome-0.3.tar.gz.
File metadata
- Download URL: Errome-0.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a96c525749bb4cabd90a7edbc1f9bc9dbcc76acdc164a57b8acf30dff7e5e411
|
|
| MD5 |
65e975273a6d0e5a46f919b9c8f037a6
|
|
| BLAKE2b-256 |
250b5843444ccf3b6cf151cad6f30e32c8706574e3e1abec55e20cca4cb91706
|
File details
Details for the file Errome-0.3-py3-none-any.whl.
File metadata
- Download URL: Errome-0.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819db86dc96e1fe75e6e3d2de651169eef8a8fdaf3e6b96e5e1131d7ded9c160
|
|
| MD5 |
f7fe53fac37d625495483dbfa872c0af
|
|
| BLAKE2b-256 |
3ba4c5e34b9ed280b5c6543a3895b2c425e62a2f38d791b8ab037999c5d48d42
|