woob.capabilities.bank.base

class CapBank[source]

Bases: CapCollection, CapCredentialsCheck

Capability of bank websites to see accounts and transactions.

check_credentials()[source]

Check that the given credentials are correct by trying to login.

The default implementation of this method check if the class using this capability has a browser, execute its do_login if it has one and then see if no error pertaining to the creds is raised. If any other unexpected error occurs, we don’t know whether the creds are correct or not.

Return type:

bool

iter_resources(objs, split_path)[source]

Iter resources.

Default implementation of this method is to return on top-level all accounts (by calling iter_accounts()).

Parameters:
  • objs (tuple[BaseObject]) – type of objects to get

  • split_path (list) – path to discover

Return type:

iter[BaseObject]

iter_accounts()[source]

Iter accounts.

Return type:

iter[Account]

get_account(id)[source]

Get an account from its ID.

Parameters:

id (str) – ID of the account

Return type:

Account

Raises:

AccountNotFound

iter_history(account)[source]

Iter history of transactions of a specific account.

Parameters:

account (Account) – account to get history

Return type:

iter[Transaction]

Raises:

AccountNotFound

iter_coming(account)[source]

Iter coming transactions of a specific account.

Parameters:

account (Account) – account to get coming transactions

Return type:

iter[Transaction]

Raises:

AccountNotFound

iter_transactions(account, *, with_history=True, with_coming=True)[source]

Iter all transactions (history and coming) of a specific account.

Parameters:
  • account (Account) – account to get transactions

  • with_history (bool) – if False, booked transactions will not be returned (default: True)

  • with_coming (bool) – if False, coming transactions will not be returned (default: True)

Return type:

iter[Transaction]

Raises:

AccountNotFound

class BaseAccount(id='0', url=NotLoaded)[source]

Bases: BaseObject, Currency

Generic class aiming to be parent of Recipient and Account.

Variables:
  • url – (str) url

  • label – (str) Pretty label

  • currency – (str) Currency (default: None)

  • bank_name – (str) Bank Name

property currency_text: str
property ban: str | NotAvailableType

Bank Account Number part of IBAN

class Account(id='0', url=NotLoaded)[source]

Bases: BaseAccount

Bank account.

Variables:
  • url – (str) url

  • label – (str) Pretty label

  • currency – (str) Currency (default: None)

  • bank_name – (str) Bank Name

  • type – (int) Type of account (default: 0)

  • owner_type – (str) Usage of account

  • balance – (Decimal) Balance on this bank account

  • coming – (Decimal) Sum of coming movements

  • iban – (str) International Bank Account Number

  • ownership – (str) Relationship between the credentials owner (PSU) and the account

  • paydate – (date, datetime) For credit cards. When next payment is due.

  • paymin – (Decimal) For credit cards. Minimal payment due.

  • cardlimit – (Decimal) For credit cards. Credit limit.

  • number – (str) Shown by the bank to identify your account ie XXXXX7489

  • valuation_diff – (Decimal) +/- values total

  • valuation_diff_ratio – (Decimal) +/- values ratio

  • management_type – (str) Management type of account (default: None)

  • company_name – (str) Name of the company of the stock - only for employee savings

  • parent – (BaseAccount) Parent account

  • opening_date – (date, datetime) Date when the account contract was created on the bank

  • all_balances – (list) List of balances (default: [])

  • party – (AccountParty) Party associated to the account (default: None)

TYPE_UNKNOWN = 0
TYPE_CHECKING = 1
TYPE_SAVINGS = 2
TYPE_DEPOSIT = 3
TYPE_LOAN = 4
TYPE_MARKET = 5
TYPE_JOINT = 6
TYPE_CARD = 7
TYPE_LIFE_INSURANCE = 8
TYPE_PEE = 9
TYPE_PERCO = 10
TYPE_ARTICLE_83 = 11
TYPE_RSP = 12
TYPE_PEA = 13
TYPE_CAPITALISATION = 14
TYPE_PERP = 15
TYPE_MADELIN = 16
TYPE_MORTGAGE = 17
TYPE_CONSUMER_CREDIT = 18
TYPE_REVOLVING_CREDIT = 19
TYPE_PER = 20
TYPE_REAL_ESTATE = 21
TYPE_CROWDLENDING = 22
TYPE_LDDS = 23
TYPE_PEL = 24
TYPE_CSL = 25
TYPE_CEL = 26
TYPE_CAT = 27
TYPE_LIVRET_A = 28
TYPE_LIVRET_B = 29
property valuation_diff_percent
class Loan(id='0', url=NotLoaded)[source]

Bases: Account

Account type dedicated to loans and credits.

Variables:
  • url – (str) url

  • label – (str) Pretty label

  • currency – (str) Currency (default: None)

  • bank_name – (str) Bank Name

  • type – (int) Type of account (default: 0)

  • owner_type – (str) Usage of account

  • balance – (Decimal) Balance on this bank account

  • coming – (Decimal) Sum of coming movements

  • iban – (str) International Bank Account Number

  • ownership – (str) Relationship between the credentials owner (PSU) and the account

  • paydate – (date, datetime) For credit cards. When next payment is due.

  • paymin – (Decimal) For credit cards. Minimal payment due.

  • cardlimit – (Decimal) For credit cards. Credit limit.

  • number – (str) Shown by the bank to identify your account ie XXXXX7489

  • valuation_diff – (Decimal) +/- values total

  • valuation_diff_ratio – (Decimal) +/- values ratio

  • management_type – (str) Management type of account (default: None)

  • company_name – (str) Name of the company of the stock - only for employee savings

  • parent – (BaseAccount) Parent account

  • opening_date – (date, datetime) Date when the account contract was created on the bank

  • all_balances – (list) List of balances (default: [])

  • party – (AccountParty) Party associated to the account (default: None)

  • name – (str) Person name

  • account_label – (str) Label of the debited account

  • insurance_label – (str) Label of the insurance

  • total_amount – (Decimal) Total amount loaned

  • available_amount – (Decimal) Amount available

  • used_amount – (Decimal) Amount already used

  • insurance_amount – (Decimal) Amount of the loan’s insurance

  • insurance_rate – (Decimal) Rate of the loan’s insurance

  • subscription_date – (date, datetime) Date of subscription of the loan

  • maturity_date – (date, datetime) Estimated end date of the loan

  • start_repayment_date – (date, datetime) Date of start repayment of the loan

  • deferred – (bool) If loan is deferred

  • duration – (int) Duration of the loan given in months

  • rate – (Decimal) Monthly rate of the loan

  • nb_payments_left – (int) Number of payments still due

  • nb_payments_done – (int) Number of payments already done

  • nb_payments_total – (int) Number total of payments

  • last_payment_amount – (Decimal) Amount of the last payment done

  • last_payment_date – (date, datetime) Date of the last payment done

  • next_payment_amount – (Decimal) Amount of next payment

  • next_payment_date – (date, datetime) Date of the next payment

class Transaction(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Bank transaction.

Variables:
  • url – (str) url

  • date – (date, datetime) Debit date on the bank statement

  • rdate – (date, datetime) Real date, when the payment has been made; usually extracted from the label or from credit card info

  • vdate – (date, datetime) Value date, or accounting date; usually for professional accounts

  • bdate – (date, datetime) Bank date, when the transaction appear on website (usually extracted from column date)

  • type – (int) Type of transaction, use TYPE_* constants (default: 0)

  • raw – (str) Raw label of the transaction

  • category – (str) Category of the transaction

  • label – (str) Pretty label

  • amount – (Decimal) Net amount of the transaction, used to compute account balance

  • coming – (bool) True if the transaction is not yet booked

  • card – (str) Card number (if any)

  • commission – (Decimal) Commission part on the transaction (in account currency)

  • gross_amount – (Decimal) Amount of the transaction without the commission

  • original_amount – (Decimal) Original net amount (in another currency)

  • original_currency – (str) Currency of the original amount

  • country – (str) Country of transaction

  • original_commission – (Decimal) Original commission (in another currency)

  • original_commission_currency – (str) Currency of the original commission

  • original_gross_amount – (Decimal) Original gross amount (in another currency)

  • attachments – (list) List of files attached to the transaction

  • investments – (list) List of investments related to the transaction (default: [])

  • counterparty – (TransactionCounterparty) Counterparty of transaction

  • bank_transaction_code – (BankTransactionCode) Bank transaction code of transaction

TYPE_UNKNOWN = 0
TYPE_TRANSFER = 1
TYPE_ORDER = 2
TYPE_CHECK = 3
TYPE_DEPOSIT = 4
TYPE_PAYBACK = 5
TYPE_WITHDRAWAL = 6
TYPE_CARD = 7
TYPE_LOAN_PAYMENT = 8
TYPE_BANK = 9
TYPE_CASH_DEPOSIT = 10
TYPE_CARD_SUMMARY = 11
TYPE_DEFERRED_CARD = 12
TYPE_INSTANT = 13
TYPE_MARKET_ORDER = 14
TYPE_MARKET_FEE = 15
TYPE_ARBITRAGE = 16
TYPE_PROFIT = 17
unique_id(seen=None, account_id=None)[source]

Get an unique ID for the transaction based on date, amount and raw.

Parameters:
  • seen (set) – if given, the method uses this set as a cache to (default: None) prevent several transactions with the same values to have the same unique ID.

  • account_id (str) – if given, add the account ID in data used to create (default: None) the unique ID. Can be useful if you want your ID to be unique across several accounts.

Returns:

an unique ID encoded in 8 length hexadecimal string (for example 'a64e1bc9')

Return type:

str

exception AccountNotFound(msg='Account not found')[source]

Bases: ObjectNotFound

Raised when an account is not found.

class AccountType(*args, **kwargs)[source]

Bases: Enum

UNKNOWN = 0
CHECKING = 1

Transaction, everyday transactions

SAVINGS = 2

Savings/Deposit, can be used for every banking

DEPOSIT = 3

Term of Fixed Deposit, has time/amount constraints

LOAN = 4

Loan account

MARKET = 5

Stock market or other variable investments

JOINT = 6

Joint account

CARD = 7

Card account

LIFE_INSURANCE = 8

Life insurances

PEE = 9

Employee savings PEE

PERCO = 10

Employee savings PERCO

ARTICLE_83 = 11

Article 83

RSP = 12

Employee savings RSP

PEA = 13

Share savings

CAPITALISATION = 14

Life Insurance capitalisation

PERP = 15

Retirement savings

MADELIN = 16

Complementary retirement savings

MORTGAGE = 17

Mortgage

CONSUMER_CREDIT = 18

Consumer credit

REVOLVING_CREDIT = 19

Revolving credit

PER = 20

Pension plan PER

REAL_ESTATE = 21

Real estate investment such as SCPI, OPCI, SCI

CROWDLENDING = 22

Crowdlending accounts

LDDS = 23

LDD/LDDS Livret de développement durable et solidaire

PEL = 24

Plan épargne logement

CSL = 25

Compte sur Livret

CEL = 26

Compte épargne logement

CAT = 27

Compte à terme

LIVRET_A = 28

Livret A

LIVRET_B = 29

Livret B

class AccountOwnership[source]

Bases: object

Relationship between the credentials owner (PSU) and the account

OWNER = 'owner'

The PSU is the account owner

CO_OWNER = 'co-owner'

The PSU is the account co-owner

ATTORNEY = 'attorney'

The PSU is the account attorney

class Balance(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Object made to receive balance on one Account

Variables:
  • url – (str) url

  • amount – (Decimal) Amount on this balance

  • type – (int) Type of balance

  • currency – (str) Currency

  • reference_date – (date, datetime) date of the balance

  • last_update – (date, datetime) Last time balance was updated

  • credit_included – (bool) If factoring is included in balance (default: False)

  • label – (str) Bank name of the balance

  • calculated – (bool) If computation has been made on the balance (default: False)

class AccountSchemeName(*args, **kwargs)[source]

Bases: Enum

IBAN = 'iban'

IBAN as defined in ISO 13616

BBAN = 'bban'

Basic Bank Account Number, represents a country-specific bank account number

SORT_CODE_ACCOUNT_NUMBER = 'sort_code_account_number'

Account Identification Number sometimes employed instead of IBAN (e.g.: in UK)

CPAN = 'cpan'

Card PAN (masked or plain)

TPAN = 'tpan'

Tokenized card PAN issued by a Token Service Provider to obfuscate the real PAN

MPAN = 'mpan'

Card PAN where some digits were replaced for security reason

BANK_PARTY_IDENTIFICATION = 'bank_party_identification'

BankPartyIdentification - Unique and unambiguous assignment made by a specific bank or similar financial institution to identify a relationship between the bank and its client.

Its definition can be found at page 13 of https://www.stet.eu/assets/files/PSD2/1-6-3/api-dsp2-stet-v1.6.3.1-part-2-functional-model.pdf

class TransactionCounterparty(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Variables:
  • url – (str) url

  • label – (str) Name of the other stakeholder (Creditor or debtor) (default: None)

  • account_scheme_name – (str) Type of account Scheme (default: None)

  • account_identification – (str) ID of the account (default: None)

  • debtor – (bool) Type of the counterparty (debtor/creditor/null) (default: None)

class PartyIdentity(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Defines the identity of a party: - full_name: Full name of the party - role: Role of the party - is_user: Defines the link between the party and the connected PSU

Variables:
  • url – (str) url

  • full_name – (str) Full name of the party. (default: None)

  • is_user – (bool) Is the party the connected PSU? (default: None)

  • role – (str) Role of the party. (default: unknown)

ROLE_UNKNOWN = 'unknown'
ROLE_HOLDER = 'holder'
ROLE_CO_HOLDER = 'co_holder'
ROLE_ATTORNEY = 'attorney'
ROLE_CUSTODIAN_FOR_MINOR = 'custodian_for_minor'
ROLE_NOMINEE = 'nominee'
ROLE_BENEFICIARY = 'beneficiary'
ROLE_SUCCESSOR_ON_DEATH = 'successor_on_death'
ROLE_TRUSTEE = 'trustee'
class AccountParty(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Defines all the information related to an account party: - party_identities: list of PartyIdentity elements - account_identifications : list of AccountIdentification elements

Variables:
  • url – (str) url

  • party_identities – (list) Identities of the account party (default: [])

  • account_identifications – (list) Identification information of the account (default: [])

class AccountIdentification(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Defines the identification of a account: - scheme_name: Name of the account scheme type - identification: ID of the account

Variables:
  • url – (str) url

  • scheme_name – (str) Name of the account scheme type (default: None)

  • identification – (str) ID of the account (default: None)

class PartyRole(*args, **kwargs)[source]

Bases: Enum

UNKNOWN = 'unknown'
HOLDER = 'holder'
CO_HOLDER = 'co_holder'
ATTORNEY = 'attorney'
CUSTODIAN_FOR_MINOR = 'custodian_for_minor'
LEGAL_GUARDIAN = 'legal_guardian'
NOMINEE = 'nominee'
BENEFICIARY = 'beneficiary'
SUCCESSOR_ON_DEATH = 'successor_on_death'
TRUSTEE = 'trustee'
class CapAccountCheck[source]

Bases: Capability

Capability to get accounts parties information.

The expected structure is the following:
  • AccountParty object
    • party_identities (list of PartyIdentity elements):
      • full name

      • role

      • is_user

    • account_identifications (list of type AccountIdentification elements):
      • scheme name

      • identification

exception NoAccountsException[source]

Bases: Exception

Raised by CapBank.iter_accounts() if we are sure there is no accounts.

Sometimes we can’t parse find accounts on websites but that’s a scraping error. To attest we know that’s a real case, this exception is raised.

class BalanceType(*args, **kwargs)[source]

Bases: Enum

CLOSING = 1

Current balance of the account

PENDING = 2

Forecast balance of the account

class BankTransactionCode(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Object dedicating to bank transaction codes It follows the ISO20022 standards. See https://www.iso20022.org/catalogue-messages/additional-content-messages/external-code-sets

Variables:
  • url – (str) url

  • domain – (str) Domain of the transaction

  • family – (str) Family of the transaction

  • sub_family – (str) Sub-family of the transaction