Skip to main content

Thai bank slip QR code parser

Project description

thanakan-qr

Thai bank slip QR code parser following the SCB specification.

Installation

pip install thanakan-qr

System Dependencies

QR parsing requires libzbar:

# Ubuntu/Debian
sudo apt-get install libzbar0

# macOS
brew install zbar

Usage

Parse from image

from PIL import Image
from thanakan_qr import SlipQRData

image = Image.open("slip.png")
data = SlipQRData.create_from_image(image)

print(f"Sending Bank: {data.payload.sending_bank_id}")
print(f"Transaction Ref: {data.payload.transaction_ref_id}")

Parse from QR string

from thanakan_qr import SlipQRData

data = SlipQRData.create_from_code("00520102...")
print(data.model_dump_json(indent=2))

API

SlipQRData

  • SlipQRData.create_from_image(image) - Parse QR from PIL Image
  • SlipQRData.create_from_code(code) - Parse QR from string

Exceptions

  • not_bank_slip - Raised when QR is not a valid bank slip
  • expect_single_qrcode - Raised when image has zero or multiple QR codes

Bank Codes

Code Bank
002 Bangkok Bank (BBL)
004 Kasikorn Bank (KBank)
006 Krung Thai Bank (KTB)
011 TMBThanachart (TTB)
014 Siam Commercial Bank (SCB)
025 Bank of Ayudhya (BAY)

Documentation

Full documentation: https://ninyawee.github.io/thanakan/libraries/thanakan-qr/

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

thanakan_qr-0.2.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

thanakan_qr-0.2.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file thanakan_qr-0.2.0.tar.gz.

File metadata

  • Download URL: thanakan_qr-0.2.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for thanakan_qr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 814ef167bc53b01b2fbe77bda6282f59c5aa0e47ba42e04f8acf1d8a9bf36cd6
MD5 506d4812e6bb09cb7c9f722cccb3d1e2
BLAKE2b-256 e508ce8f2f2ae891ff9a329284e9379a27fa6295f4517280689e362e797584f4

See more details on using hashes here.

File details

Details for the file thanakan_qr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: thanakan_qr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for thanakan_qr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2aa215f38e80474851e6be259bc0dc29209e70dd5cf04a314d312461e6a34d25
MD5 77c7dbb41723d45e928b63f402083aaa
BLAKE2b-256 ffeb5d6b4dde01a2f2021b6159d71e123dad0ebd487eb30dce8bb69f18b1e39f

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