Skip to main content

A package for extracting JSON data from Maybank PDF account statements

Project description

maybankpdf2json

PyPI version CI

Convert Maybank PDF statements into structured data.

TL;DR

  • Use one method: json()
  • Output includes: account_number, statement_date, transactions

Install

pip install maybankpdf2json

Usage

from maybankpdf2json import MaybankPdf2Json

with open("statement.pdf", "rb") as f:
  data = MaybankPdf2Json(f, "your_pdf_password").json()  # No password? Omit the second argument.

print(data)

Example output:

{
  "account_number": "162021-851156",
  "statement_date": "30/09/24",
  "transactions": [
    {
      "date": "01/09/24",
      "desc": "BEGINNING BALANCE",
      "trans": 0,
      "bal": 3285.77
    }
  ]
}

Response Schema

Root Object

Field Type Format Notes
account_number str | None NNNNNN-NNNNNN May be None if not detected
statement_date str | None dd/mm/yy May be None if not detected
transactions list[Transaction] Array Ordered as parsed from statement

Transaction Object

Field Type Format Example
date str dd/mm/yy 01/09/24
desc str Free text BEGINNING BALANCE
trans float | int Signed numeric -10.0, 0, 250.5
bal float Signed numeric 3285.77

Date format is dd/mm/yy.

Quick Full-Data Test (tests folder)

  1. Put your statement PDF at tests/test.pdf.
  2. Run this from the project root:
TEST_PDF_PASSWORD='passwordOfTest.pdf' python3 -c "import json, os; from maybankpdf2json.extractor import MaybankPdf2Json; f=open('tests/test.pdf','rb'); print(json.dumps(MaybankPdf2Json(f, os.environ.get('TEST_PDF_PASSWORD','')).json(), indent=2)); f.close()"

If your PDF has no password, use TEST_PDF_PASSWORD=''.

MIT License.

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

maybankpdf2json-0.2.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

maybankpdf2json-0.2.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file maybankpdf2json-0.2.3.tar.gz.

File metadata

  • Download URL: maybankpdf2json-0.2.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for maybankpdf2json-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bfd2cb641dfe69308286f50cf621e907f8de8d693d70eb4d4a821cd872772039
MD5 03fb76901af25b1b0f4c2adbbdf2934a
BLAKE2b-256 d9cf0aa0afd0b9fdf7141d4d7f7fc11d80e518662de4b72739353e7e2e4b482d

See more details on using hashes here.

Provenance

The following attestation bundles were made for maybankpdf2json-0.2.3.tar.gz:

Publisher: publish.yml on nordinz7/maybankpdf2json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file maybankpdf2json-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for maybankpdf2json-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99dfd4a99046f40344e1028917002b179e9a9aa13413f796006808d79ea033b8
MD5 68c5bbf3df3c6cb441f2f51e83c36219
BLAKE2b-256 f1e3dadf45f92e46f6f1ce6696554fba04caf4e9ef3d840d4461f16c142f4d15

See more details on using hashes here.

Provenance

The following attestation bundles were made for maybankpdf2json-0.2.3-py3-none-any.whl:

Publisher: publish.yml on nordinz7/maybankpdf2json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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