Code Monkey home page Code Monkey logo

bankkonto's Introduction

Bankkonto

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

bankkonto's People

Contributors

pn avatar hbldh avatar narel avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.