Bankkonto
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
Metadata
Release files for bankkonto 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bankkonto-1.0.1.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bankkonto-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / bankkonto-1.0.1.tar.gz
| Download URL | bankkonto-1.0.1.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afda5bc1fdcaa426a7cade2a7a9814886b303d4cb24b731e0a164316d08c6d81
|
|
BLAKE2b-256 checksum How to use checksums |
d7b278446d46833217333e11d38ad0274026761750c40dc11b258db1de7075e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2025.
Transparency logRelease files / bankkonto-1.0.1-py3-none-any.whl
| Download URL | bankkonto-1.0.1-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dead47bf59ad8c12365f223cb20376a05b9e2618b4b0e94b31332029bae3419
|
|
BLAKE2b-256 checksum How to use checksums |
488ee11ad0a02ab74ab3f0640434eb8323e29b74b8e4e4b7a0160498052baa55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 27, 2025.
Transparency log