Skip to main content

Python validation library for Swedish bank account numbers

Project description

https://github.com/hbldh/bankkonto/workflows/Build%20and%20Test/badge.svg https://coveralls.io/repos/github/hbldh/bankkonto/badge.svg?branch=master

A tool for cleaning, parsing and ultimately validating Swedish bank account numbers, primarily written to be used for web applications with form data.

Installation

$ pip install git+https://github.com/hbldh/bankkonto.git@master

Documentation

Will be available on ReadTheDocs eventually.

Usage

Direct usage for validating a bank account number:

>>> import bankkonto
>>> bankkonto.validate('9029', '5735211')
True
>>> bankkonto.validate('9029', '5735214')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hbldh/Repos/bankkonto/account.py", line 117, in validate
    bank_account_number, bank_name, bank_account_number[-1]))
bankkonto.exceptions.BankkontoValidationError: Bank account number 5735214 for Länsförsäkringar Bank has invalid control digit: 4

Clean a entered string containing both clearing number and bank account number:

>>> import bankkonto
>>> cn, bn = bankkonto.clean_and_split('8156-6 111.222.333-2')
>>> print(cn)
'81566'
>>> print(bn)
'1112223332'
>>> bankkonto.validate(cn, bn)
True

There is also a WTForms validator at bankkonto.flask.BankkontoValidator that can be used with e.g. Flask-WTF.

Tests

Run with pytest:

$ py.test tests/ --cov bankkonto --cov-report term-missing

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

bankkonto-1.0.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

bankkonto-1.0.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file bankkonto-1.0.0.tar.gz.

File metadata

  • Download URL: bankkonto-1.0.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bankkonto-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ce823ae44c272c2b3f6e7a5d24ce852a33e68e7be0a71ce561e9dd47f882f006
MD5 dab179d83d691676512999e7646a9e49
BLAKE2b-256 240584c23c76e64990c8bddc4e50b1e99a6a8a7a1b5dddc1d37d59f32d9cde8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankkonto-1.0.0.tar.gz:

Publisher: python-publish.yml on hbldh/bankkonto

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

File details

Details for the file bankkonto-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bankkonto-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bankkonto-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 314b907fc6fe250d01bcdcf49632cecff983927aec8b8253a8507a3b62827af2
MD5 1291284c0010c9161e771787a0811489
BLAKE2b-256 f2f765bb439cf8fc33b80307d5020148c74b1fb7f63185bcc41a525ff038cbd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankkonto-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on hbldh/bankkonto

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