Skip to main content

Python validation library for Swedish bank account numbers

Project description

Bankkonto

Build and Test Upload Python Package

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 bankkonto

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 an 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:

pytest tests

Install pytest-cov first, and get coverage report:

pytest 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.1.tar.gz (9.8 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.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bankkonto-1.0.1.tar.gz
  • Upload date:
  • Size: 9.8 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.1.tar.gz
Algorithm Hash digest
SHA256 afda5bc1fdcaa426a7cade2a7a9814886b303d4cb24b731e0a164316d08c6d81
MD5 23680357f9761ab91e52b81fb602cc2f
BLAKE2b-256 d7b278446d46833217333e11d38ad0274026761750c40dc11b258db1de7075e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankkonto-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: bankkonto-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6dead47bf59ad8c12365f223cb20376a05b9e2618b4b0e94b31332029bae3419
MD5 62ec3a4737e139a1e295541f1c13a9ce
BLAKE2b-256 488ee11ad0a02ab74ab3f0640434eb8323e29b74b8e4e4b7a0160498052baa55

See more details on using hashes here.

Provenance

The following attestation bundles were made for bankkonto-1.0.1-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