Skip to main content

Download billing files from email with configurable providers

Project description

Emlex

Emlex 从任意 IMAP 邮箱中筛选目标邮件,并把附件或邮件中的下载链接保存到本地。

安装

项目要求 Python 3.10 及以上版本:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"

安装后使用 em 命令,也可以在源码目录运行 python -m cli.main

全屏 TUI

启动邮箱与下载任务管理界面:

em ui

em ui 会打开真正的全屏终端界面:左侧管理多个下载任务,右侧配置邮箱登录和下载规则,底部显示连接与保存状态。

支持的邮箱与认证方式:

  • Gmail、Outlook / Microsoft 365、QQ、163、iCloud、Yahoo;
  • 任意自定义 IMAP 服务;
  • 密码或应用专用密码;
  • OAuth2 Access Token;
  • SSL/TLS、STARTTLS,以及仅供受信网络使用的明文 IMAP。

下载规则支持:

  • 按主题关键字、发件人和回溯天数筛选邮件;
  • 下载任意后缀的附件,如 ZIP、PDF、CSV、XLSX;
  • 从 HTML 邮件中按链接文字查找并下载任意文件类型;
  • 自定义保存目录、文件后缀和 HTTP 超时;
  • 创建任意任务标识,不再局限于支付宝和微信。

常用按键:

按键 操作
Ctrl+N 新建任务
Ctrl+S 保存任务
Ctrl+T 测试邮箱连接
Ctrl+D 删除任务(需按两次确认)
Q 退出

旧的提示式命令 em config email add 仍保留用于脚本兼容。

如果不希望把密码直接写入 JSON,可保存环境变量引用:

em config email add \
  --provider alipay \
  --email-type gmail \
  --username you@example.com \
  --password-env EMLEX_EMAIL_PASSWORD

然后在 ~/.flow/.env 中设置密码:

EMLEX_EMAIL_PASSWORD=your-app-password

自定义 IMAP 示例:

em config email add \
  --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 bank_pdf

使用其他配置文件:

em download --provider alipay --config /path/to/config.json

TUI 保存后会自动生成完整任务配置。你也可以直接编辑 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

emlex-1.2.1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emlex-1.2.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file emlex-1.2.1.tar.gz.

File metadata

  • Download URL: emlex-1.2.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for emlex-1.2.1.tar.gz
Algorithm Hash digest
SHA256 7fb382acd94c345b5eddc634be11494b5d7c0c5bd63acc6f75212d6ad20195ea
MD5 8e75b8b15e28c4aec8849abce0cbec58
BLAKE2b-256 d11567ec55725deeab4e1c5986229bbd7949816e7f0626de7131d7aca257b4ab

See more details on using hashes here.

File details

Details for the file emlex-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: emlex-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for emlex-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8bf31a8ce43e19b7fce85505141bc399c5a51002f59069753d907c3713dd25
MD5 e3b69cecb65e501b80a522869857cfc9
BLAKE2b-256 6db71a65c4312893486310b041fad8ca1e31fdef8f64e9255fe30d52a064ecf1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page