thanakan-statement
Thai bank PDF statement parser for KBank, BBL, and SCB.
Installation
pip install thanakan-statement
Usage
Parse single PDF
from thanakan_statement import parse_pdf
statement = parse_pdf("statement.pdf", password="DDMMYYYY")
print(f"Account: {statement.account_number}")
print(f"Bank: {statement.bank}")
print(f"Transactions: {len(statement.transactions)}")
Parse directory
from thanakan_statement import parse_all_pdfs
statements = parse_all_pdfs("./statements/", password="DDMMYYYY")
Consolidate by account
from thanakan_statement import parse_all_pdfs, consolidate_by_account
statements = parse_all_pdfs("./statements/")
accounts = consolidate_by_account(statements, preferred_language="en")
for account in accounts:
print(f"{account.account_number}: {len(account.all_transactions)} transactions")
Export
from thanakan_statement import (
parse_all_pdfs,
consolidate_by_account,
export_to_json,
export_to_csv,
export_to_excel,
)
statements = parse_all_pdfs("./statements/")
accounts = consolidate_by_account(statements)
# Export to JSON
export_to_json(accounts, "output.json")
# Export to CSV (one file per account)
export_to_csv(accounts, "./csv_output/")
# Export to Excel (one sheet per account)
export_to_excel(accounts, "output.xlsx")
Validate balance continuity
from thanakan_statement import parse_all_pdfs, validate_balance_continuity
statements = parse_all_pdfs("./statements/")
statements.sort(key=lambda s: s.statement_period_start)
is_valid, issues = validate_balance_continuity(statements)
if not is_valid:
for issue in issues:
print(f"Issue in {issue.statement.source_pdf}")
Supported Banks
| Bank | Statement Format | Languages |
|---|---|---|
| KBank | Thai, English | |
| BBL | Thai, English | |
| SCB | Thai, English |
PDF Password
Most bank statement PDFs are password-protected with birthdate (DDMMYYYY):
# Specify directly
statement = parse_pdf("statement.pdf", password="02011995")
# Or use environment variable
import os
os.environ["PDF_PASS"] = "02011995"
statement = parse_pdf("statement.pdf")
Documentation
Full documentation: https://ninyawee.github.io/thanakan/libraries/thanakan-statement/
Metadata
Release files for thanakan-statement 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_statement-0.2.0.tar.gz | 12.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| thanakan_statement-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / thanakan_statement-0.2.0.tar.gz
| Download URL | thanakan_statement-0.2.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
480c9e7a52e02e5813d0996c105b2db17d2214d69c836d420585e615edee934d
|
|
BLAKE2b-256 checksum How to use checksums |
51367bc0c044ca81fac5d34ee5ab6a3ffaa12c53dc86e0e42950b52458cf3a5f
|
| 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_statement-0.2.0-py3-none-any.whl
| Download URL | thanakan_statement-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90afdb13d1cdbc9d3a96e1d4fcf845ef139b1051d7619759804a7ccd70f85b06
|
|
BLAKE2b-256 checksum How to use checksums |
e4f3477a120ae58661508a066547be8a2cc87417c25da82988e45bd70435d9f3
|
| 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-statement 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.