This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Gotta get schwifty with your IBANs

Schwifty is a Python library for working with BICs and IBANs. It allows you to

  • validate check-digits and the country specific format of IBANs
  • validate format and country codes from BICs
  • generate BICs from bank-codes (works for Germany for now)
  • generate IBANs from country-code, bank-code and account-number.
  • access all relevant components as attributes

Usage

IBAN

Let’s jump right into it:

>>> from schwifty import IBAN
>>> iban = IBAN('DE89 3704 0044 0532 0130 00')
>>> iban.compact
'DE89370400440532013000'
>>> iban.formatted
'DE89 3704 0044 0532 0130 00'
>>> iban.country_code
'DE'
>>> iban.bank_code
'37040044'
>>> iban.account_code
'0532013000'
>>> iban.length
22
>>> iban.bic
<BIC=COBADEFFXXX>

So far so good. So you are able to create an IBAN-object and to access all relevant components of the IBAN as properties. As you can see on the last line, you can also get ahold of the BIC number associated to the bank-code of the IBAN. This currently only works for IBANs of german banks.

Behind the scenes the IBAN has been validated at the moment of instantiation. With respect to ISO 13616 compliance it is checked if the format of the account-code, the bank-code and possibly the branch-code have the correct country-specific format. Whenever you pass an invalid IBAN to the __init__-method, you’ll get a ValueError with an appropriate error message.

>>> IBAN('DX89 3704 0044 0532 0130 00')
...
ValueError: Unknown country-code DX

>>> IBAN('DE99 3704 0044 0532 0130 00')
...
ValueError: Invalid checksum digits

But what if you wan’t to generate an IBAN from a bank-code and the account-code? Use the generate-classmethod!

>>> iban = IBAN.generate('DE', bank_code='10010010', account_code='12345')
<IBAN=DE40100100100000012345>
>>> iban.checksum_digits
'40'

Notice that even that the account-code has less digits than required (in Germany accounts should be 10 digits long), zeros have been added at the correct location. Additionally the checksum digits have been calculated, which is good.

BIC

Besides the IBAN there is the Business Identifier Code (BIC). It is a unique identification code for both financial and non-financial institutes. Schwifty also has a BIC-object which more or less has the same interface than the IBAN-object.

>>> from schwifty import BIC
>>> bic = BIC('PBNKDEFFXXX')
>>> bic.bank_code
'PBNK'
>>> bic.branch_code
'XXX'
>>> bic.country_code
'DE'
>>> bic.location_code
'FF'
>>> bic.country_bank_code
'86010090'

The country_bank_code is the country specific bank code as you can find it in the IBAN. This mapping is currently only available for german BICs.

The BIC-object also does some basic validation on instantation and raises a ValueError if the country-code, the BIC´s length is invalid or if the strucutre doesn’t match the ISO 9362 specification.

>>> BIC('PBNKDXFFXXX')
...
ValueError: Invalid country code DX
>>> BIC('PBNKDXFFXXXX')
...
ValueError: Invalid length 12
>>> BIC('PBN1DXFFXXXX')
...
ValueError: Invalid structure PBN1DXFFXXXX

If Schwifty´s internal registry contains the BICs for your country (this again currently only works for Germany), then you can use the exists-property to check that the BIC is registered.

Installation

To install Schwifty, simply:

$ pip install schwifty

Name

Since swift and swiftly were already taken by the OpenStack-project, but we somehow wanted to point out the connection to SWIFT, Rick and Morty came up with the idea to name the project schwifty.

Release History

Release History

1.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1.dev3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
schwifty-1.1.1-py2.py3-none-any.whl (106.1 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Oct 19, 2016
schwifty-1.1.1.tar.gz (113.7 kB) Copy SHA256 Checksum SHA256 Source Oct 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting