thanakan-mail
Download Thai bank PDF statements from email (Gmail).
Features
- OAuth 2.0 authentication with Gmail API
- Download PDF statement attachments from KBank, BBL, and SCB emails
- Filter by bank-specific sender addresses and filename patterns
- Extensible provider architecture for future email services
Environment Variables
GMAIL_CLIENT_SECRET: Path to Google OAuth client_secret.json (required)GMAIL_TOKEN_PATH: Path to store OAuth token (default: ~/.thanakan/gmail_token.json)
CLI Usage
# Authenticate with Gmail
thanakan mail auth
# Download statements from a specific bank
thanakan mail download kbank
thanakan mail download bbl --output ./statements
thanakan mail download scb --max 50
# Download from all supported banks
thanakan mail download all
# Download and parse PDFs in one step
thanakan mail download kbank --parse
Library Usage
from thanakan_mail import GmailProvider, StatementDownloader, BANK_CONFIGS
# Initialize provider and downloader
provider = GmailProvider()
downloader = StatementDownloader(provider, BANK_CONFIGS["kbank"], "./downloads")
# Download statements
results = downloader.download_statements(max_emails=100, verbose=True)
# Check results
for result in results:
print(f"Email: {result.message.subject}")
print(f" Downloaded: {result.downloaded_files}")
print(f" Skipped: {result.skipped_attachments}")
print(f" Errors: {result.errors}")
Setup
- Create a Google Cloud project and enable the Gmail API
- Create OAuth 2.0 credentials (Desktop application)
- Download the client_secret.json file
- Set the
GMAIL_CLIENT_SECRETenvironment variable to the file path - Run
thanakan mail authto complete OAuth flow
Metadata
Release files for thanakan-mail 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| thanakan_mail-0.2.0.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| thanakan_mail-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.7 kB
Release files / thanakan_mail-0.2.0.tar.gz
| Download URL | thanakan_mail-0.2.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2ce3ee6d789b7ba203905a243cd16adc7cea1e10af7d9ee4f00a36a3d21b8d4
|
|
BLAKE2b-256 checksum How to use checksums |
9d14c0c8f954dbd88f4f066a9c42a2c231a55e21cb0e438ade234bfe4ab0606f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / thanakan_mail-0.2.0-py3-none-any.whl
| Download URL | thanakan_mail-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18966a86be80c778106faafffd66f79e3b341d6628f1ce3ecf8d14062e75ec95
|
|
BLAKE2b-256 checksum How to use checksums |
46d87aff23b4009850aec503cddfef9976769e54c9e192baed2130ec9b529f86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for thanakan-mail 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.