Developer Interface¶
IBAN¶
-
class
schwifty.
IBAN
(iban, allow_invalid=False)[source]¶ The IBAN object.
Examples
You create a new IBAN object by supplying an IBAN code in text form. The IBAN is validated behind the scenes and you can then access all relevant components as properties:
>>> iban = IBAN('DE89 3704 0044 0532 0130 00') >>> iban.account_number '0532013000' >>> iban.bank_code '37040044' >>> iban.country_code 'DE' >>> iban.check_digits '89'
Parameters: - iban (str) – The IBAN code.
- allow_invalid (bool) – If set to True IBAN validation is skipped on instantiation.
-
account_code
¶ str – The customer specific account-code
-
bank_code
¶ str – The country specific bank-code.
-
bban
¶ str – The BBAN part of the IBAN.
-
bic
¶ BIC – The BIC associated to the IBAN´s bank-code.
-
branch_code
¶ str or None – The branch-code of the bank if available.
-
checksum_digits
¶ str – Two digit checksum of the IBAN.
-
compact
¶ str – Compact representation of the code.
-
country_code
¶ str – ISO 3166 alpha-2 country code.
-
formatted
¶ str – The IBAN formatted in blocks of 4 digits.
-
classmethod
generate
(country_code, bank_code, account_code)[source]¶ Generate an IBAN from it’s components.
If the bank-code and/or account-number have less digits than required by their country specific representation, the respective component is padded with zeros.
Examples
To generate an IBAN do the following:
>>> bank_code = '37040044' >>> account_code = '532013000' >>> iban = IBAN.generate('DE', bank_code, account_code) >>> iban.formatted 'DE89 3704 0044 0532 0130 00'
Parameters: - country_code (str) – The ISO 3166 alpha-2 country code.
- bank_code (str) – The country specific bank-code.
- account_code (str) – The customer specific account-code.
-
length
¶ int – Length of the compact code.
-
numeric
¶ int – A numeric represenation of the IBAN.
-
spec
¶ dict – The country specific IBAN specification.
BIC¶
-
class
schwifty.
BIC
(bic, allow_invalid=False)[source]¶ The BIC object.
Examples
You can either create a new BIC object by providing a code as text:
>>> bic = BIC('GENODEM1GLS') >>> bic.country_code 'DE' >>> bic.location_code 'M1' >>> bic.bank_code 'GENO'
or by using the
from_bank_code()
classmethod:>>> bic = BIC.from_bank_code('DE', '43060967') >>> bic.formatted 'GENO DE M1 GLS'
Parameters: - bic (str) – The BIC number.
- allow_invalid (bool) – If set to
True
validation is skipped on instantiation.
-
bank_code
¶ str – The bank-code part of the BIC.
-
branch_code
¶ str or None – The branch-code part of the BIC (if available)
-
compact
¶ str – Compact representation of the code.
-
country_bank_code
¶ str or None – The country specific bank-code associated to the BIC.
-
country_code
¶ str – The ISO 3166 alpha2 country-code.
-
exists
¶ bool – Indicates if the BIC is available in Schwifty’s registry.
-
formatted
¶ str – The BIC separated in the blocks bank-, country- and location-code.
-
classmethod
from_bank_code
(country_code, bank_code)[source]¶ Create a new BIC object from country- and bank-code.
Parameters: - country_code (str) – ISO 3166 alpha2 country-code.
- bank_code (str) – Country specific bank-code.
Note
This currently only works for German bank-codes.
-
length
¶ int – Length of the compact code.
-
location_code
¶ str – The location code of the BIC.
-
type
¶ Indicates the type of BIC.
This can be one of ‘testing’, ‘passive’, ‘reverse billing’ or ‘default’
Returns: The BIC type. Return type: str