Download billing files from email with configurable providers
Project description
Emlex
Emlex 从邮箱中查找支付宝、微信等账单邮件,并把附件或邮件中的下载链接保存到本地。
安装
项目要求 Python 3.10 及以上版本:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
安装后使用 em 命令,也可以在源码目录运行 python -m cli.main。
交互式添加邮箱
启动终端配置向导:
em ui
旧命令 em config email add 仍可继续使用。
向导支持:
- Gmail(建议使用应用专用密码);
- 任意支持 SSL 的 IMAP 邮箱;
- 支付宝和微信账单配置;
- 更新已有邮箱时保留下载方式和账单匹配规则;
- 密码隐藏输入、写入前确认以及
0600配置文件权限。
如果不希望把密码直接写入 JSON,可保存环境变量引用:
em ui \
--provider alipay \
--email-type gmail \
--username you@example.com \
--password-env EMLEX_EMAIL_PASSWORD
然后在 ~/.flow/.env 中设置密码:
EMLEX_EMAIL_PASSWORD=your-app-password
自定义 IMAP 示例:
em ui \
--provider wechat \
--email-type imap \
--username you@example.com \
--host imap.example.com \
--port 993
默认配置文件为 ~/.flow/config.json。开发和测试时可通过 --config 指定其他路径。
下载账单
em download --provider alipay
em download --provider wechat
使用其他配置文件:
em download --provider alipay --config /path/to/config.json
首次添加邮箱时,向导会生成可用的最小 provider 配置。你可以继续编辑 profile 来精确匹配邮件:
{
"alipay": {
"email": "gmail",
"auth_type": "pass",
"auth": {
"username": "you@example.com",
"password": "${EMLEX_EMAIL_PASSWORD}"
},
"download": "attachment",
"profile": {
"name": "alipay",
"search_subject": "支付宝",
"sender_email": "service@example.com",
"file_suffix": "zip",
"encoding": "gbk"
}
}
}
download 可设为 attachment(兼容旧拼写 attchment)或 link。下载文件默认保存在 ~/.flow/data/<provider>/。
测试
python -m pytest
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 emlex-1.1.1.tar.gz.
File metadata
- Download URL: emlex-1.1.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfc322fbddbfe7231f7086cc9672a3bc74a958f95ca7665cdf701a3529189c9d
|
|
| MD5 |
e5cacc0e107f91a1a5f5b4a66d752f26
|
|
| BLAKE2b-256 |
2189add769cbf2bc0ebad52a372980725429fb9f626da07d2c4c634fdf61ad37
|
File details
Details for the file emlex-1.1.1-py3-none-any.whl.
File metadata
- Download URL: emlex-1.1.1-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
099eeace91d514dab1db072699a3c1739c784dcb2ad8dab115a09eba0586851d
|
|
| MD5 |
a1317c02d2fed2058bc0d1bd7b5f8330
|
|
| BLAKE2b-256 |
fab2e20daa9416eb20ae7c87c4e1fbb6b1b49b65a32c2dc92b8e08235091084d
|