weboob.tools.capabilities.bank.transactions

class weboob.tools.capabilities.bank.transactions.FrenchTransaction(id='', *args, **kwargs)

Bases: weboob.capabilities.bank.Transaction

Transaction with some helpers for french bank websites.

class Amount(credit, debit=None, replace_dots=True)

Bases: weboob.browser.filters.base.Filter

class FrenchTransaction.Currency(selector=None, symbols='', replace=[], children=True, newlines=True, normalize='NFC', **kwargs)

Bases: weboob.browser.filters.standard.CleanText

Parameters:
  • symbols (list) – list of strings to remove from text
  • replace (list[tuple[str, str]]) – optional pairs of text replacements to perform
  • children (bool) – whether to get text from children elements of the select elements
  • newlines (bool) – if True, newlines will be converted to space too
  • normalize (str or None) – Unicode normalization to perform
filter(text)
class FrenchTransaction.Date(selector=None, symbols='', replace=[], children=True, newlines=True, normalize='NFC', **kwargs)

Bases: weboob.browser.filters.standard.CleanText

Parameters:
  • symbols (list) – list of strings to remove from text
  • replace (list[tuple[str, str]]) – optional pairs of text replacements to perform
  • children (bool) – whether to get text from children elements of the select elements
  • newlines (bool) – if True, newlines will be converted to space too
  • normalize (str or None) – Unicode normalization to perform
filter(date)
FrenchTransaction.PATTERNS = []
classmethod FrenchTransaction.Raw(klass, *args, **kwargs)
FrenchTransaction.TransactionElement

alias of _TransactionElement

FrenchTransaction.TransactionsElement

alias of _TransactionsElement

classmethod FrenchTransaction.clean_amount(klass, text)

Clean a string containing an amount.

FrenchTransaction.parse(date, raw, vdate=None)

Parse date and raw strings to create datetime.date objects, determine the type of transaction, and create a simplified label

When calling this method, you should have defined patterns (in the PATTERN class attribute) with a list containing tuples of regexp and the associated type, for example:

PATTERNS = [(re.compile(r'^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
            (re.compile(r'^PRLV (?P<text>.*)'),        FrenchTransaction.TYPE_ORDER),
            (re.compile(r'^(?P<text>.*) CARTE \d+ PAIEMENT CB (?P<dd>\d{2})(?P<mm>\d{2}) ?(.*)$'),
                                                       FrenchTransaction.TYPE_CARD)
           ]

In regexps, you can define this patterns:

  • text: part of label to store in simplified label
  • category: part of label representing the category
  • yy, mm, dd, HH, MM: date and time parts
FrenchTransaction.parse_date(date)
FrenchTransaction.set_amount(credit='', debit='')

Set an amount value from a string.

Can take two strings if there are both credit and debit columns.

class weboob.tools.capabilities.bank.transactions.AmericanTransaction(id=u'', url=NotLoaded, backend=None)

Bases: weboob.capabilities.bank.Transaction

Transaction with some helpers for american bank websites.

classmethod clean_amount(klass, text)

Clean a string containing an amount.

classmethod decimal_amount(klass, text)

Convert a string containing an amount to Decimal.

weboob.tools.capabilities.bank.transactions.sorted_transactions(iterable)

Sort an iterable of transactions in reverse chronological order

weboob.tools.capabilities.bank.transactions.merge_iterators(*iterables)

Merge transactions iterators keeping sort order.

Each iterator must already be sorted in reverse chronological order.

weboob.tools.capabilities.bank.transactions.keep_only_card_transactions(it, match_func=None)

Filter iterator to keep transactions with card types.

This helper should typically be used when a banking site returns card and non-card transactions mixed on the same checking account.

Types kept are TYPE_DEFERRED_CARD and TYPE_CARD_SUMMARY. Additionally, the amount is inversed for transactions with type TYPE_CARD_SUMMARY. This is because on the deferred debit card account, summaries should be positive as the amount is debitted from checking account to credit the card account.

The match_func can be provided in case of multiple cards, to only return transactions of one card.

Parameters:match_func (callable or None) – optional function to filter transactions further
weboob.tools.capabilities.bank.transactions.omit_deferred_transactions(it)

Filter iterator to omit transactions with type TYPE_DEFERRED_CARD.

This helper should typically be used when a banking site returns card and non-card transactions mixed on the same checking account.