Introduction
This is a tool that logs everything your program printing on the screen, and sends you an email when the program is finished or terminated.
Usage
First, create ~/.autosend.yaml using the following template and modify the configs.
# =========== autosend yaml template ============
# specify the email SMTP server
username: "username"
password: "password"
server: smtp.example.com
port: 25
tls: False
timeout: 15
# specify the email subject format, where:
# {path} implies the work_dir running the python script,
# {curtime} implies the current date and time
# {status} implies the log type (may be running or complete)
subject_format: "【符合保密要求,可在手机端查阅】{path}日志 [{curtime}] [{status}]"
# specify the email sender's and receivers' addresses
sender: "example@example.com"
receivers:
- "example@example.com"
# send logs by email only if the program runs after the specific seconds
send_after_seconds: 3600
# send logs by email EVERY specific seconds if the program is keep running
send_periods: 86400
# whether send html format logs instead of plain text
html: True
Then add the following line in your code:
import autosend
After the program is finished or after a specific time, you will get an email like:
【符合保密要求,可在手机端查阅】Python Scripts日志 [2023-05-14 13:45] [completed]
xx send to xx 2023-05-14 13:46:27
start_time: 2023-05-14 13:45
last update: 2023-05-14 13:46
work_dir: D:\Users\A\Documents\Python Scripts
args: test.py
================= last 100 lines of the log =================
1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'date' is not defined
1684043182.6202037
1 attachments
Metadata
Release files for autosend 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autosend-0.0.5.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autosend-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / autosend-0.0.5.tar.gz
| Download URL | autosend-0.0.5.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8c3187320168b970e80eefcab662b5dcfbe10e81d7e48fe0f724e4551207b60
|
|
BLAKE2b-256 checksum How to use checksums |
be73f5edf494d3486943f066fc7abd91dd556e84395be1ad561600c4c3b23f64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / autosend-0.0.5-py3-none-any.whl
| Download URL | autosend-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b025b71a7e0a92007a58d90032f2baf5a149478a046a78588731bd594d2f2c4a
|
|
BLAKE2b-256 checksum How to use checksums |
2913d19a3a06504aa58c7ae50aa4da145676ef6175fdc353e3932153937944b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|