boursorama: support market investments

This commit is contained in:
Romain Bignon 2015-08-26 20:38:04 +02:00 committed by Romain Bignon
commit eab5e13189
4 changed files with 42 additions and 12 deletions

View file

@ -28,17 +28,22 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction
class AccountsList(Page):
def on_loaded(self):
pass
ACCOUNT_TYPES = {u'banque': Account.TYPE_CHECKING,
u'épargne': Account.TYPE_SAVINGS,
u'crédit': Account.TYPE_LOAN,
u'assurance vie': Account.TYPE_LIFE_INSURANCE,
u'bourse': Account.TYPE_MARKET,
}
def get_list(self):
blocks = self.document.xpath('//div[@id="synthese-list"]//div[@class="block"]')
for div in blocks:
block_title = ''.join(div.xpath('.//span[@class="title"]//text()')).lower()
block_title = ''.join(div.xpath('.//span[@class="title"]/a/text()')).lower().strip()
for tr in div.getiterator('tr'):
account = Account()
account.id = None
account._link_id = None
account.type = self.ACCOUNT_TYPES.get(block_title, Account.TYPE_UNKNOWN)
if 'assurance vie' in block_title:
# Life insurance accounts are investments
account.type = Account.TYPE_LIFE_INSURANCE