The new woob repository is here: This gitlab will be removed soon.

Commit 7439da49 authored by thibault douge's avatar thibault douge Committed by Vincent A

[boursedirect] remove the part of life insurance

now life insurance is on another bourseedirect site, this requires the development of a new connector
parent 61372321
......@@ -29,8 +29,7 @@
from .pages import (
LoginPage, PasswordRenewalPage, AccountsPage, HistoryPage,
InvestPage, MarketOrdersPage, MarketOrderDetailsPage,
LifeInsurancePage, IsinPage, PortfolioPage, JsRedirectPage,
IsinPage, PortfolioPage, JsRedirectPage, HomePage,
......@@ -52,11 +51,6 @@ class BoursedirectBrowser(LoginBrowser):
invests = URL(r'/streaming/compteTempsReelCK.php\?stream=0', InvestPage)
market_orders = URL(r'/priv/new/ordres-en-carnet.php\?ong=7&nc=(?P<nc>\d+)', MarketOrdersPage)
market_orders_details = URL(r'/priv/new/detailOrdre.php', MarketOrderDetailsPage)
lifeinsurance = URL(
isin_page = URL(r'/fr/marche/', IsinPage)
js_redirect = URL(r'/priv/fiche-valeur.php', JsRedirectPage)
......@@ -77,14 +71,6 @@ def do_login(self):
def iter_accounts(self):
for account in self.iter_accounts_but_insurances():
yield account
if and
def iter_accounts_but_insurances(self):
for account in
......@@ -93,18 +79,12 @@ def iter_accounts_but_insurances(self):
def iter_investment(self, account):
if account.type == account.TYPE_LIFE_INSURANCE:
for inv in
yield inv
for inv in
yield inv
for inv in
yield inv
def iter_market_orders(self, account):
......@@ -125,9 +105,7 @@ def iter_market_orders(self, account):
def iter_history(self, account):
if account.type == account.TYPE_LIFE_INSURANCE:
elif account.type in (account.TYPE_MARKET, account.TYPE_PEA):
if account.type in (account.TYPE_MARKET, account.TYPE_PEA):
raise NotImplementedError()
......@@ -406,109 +406,6 @@ def get_isin(self):
class LifeInsurancePage(BasePage):
def has_account(self):
message = CleanText('//fieldset[legend[text()="Message"]]')(self.doc)
if 'Vous n´avez pas de contrat. Ce service ne vous est pas accessible.' in message:
return False
return True
class get_account(ItemElement):
klass = Account
obj_balance = CleanDecimal.French('''//label[text()="Valorisation de l'encours"]/following-sibling::b[1]''')
obj_currency = 'EUR'
obj_id = obj_number = CleanText('''//label[text()="N° d'adhésion"]/following-sibling::b[1]''')
obj_label = Format(
'%s (%s)',
obj_type = Account.TYPE_LIFE_INSURANCE
class iter_investment(TableElement):
head_xpath = '//fieldset[legend[text()="Répartition de l´encours"]]/table/tr[@class="place"]/th'
item_xpath = '//fieldset[legend[text()="Répartition de l´encours"]]/table/tr[@class!="place"]'
col_label = 'Nom des supports'
col_quantity = 'Nombre de parts'
col_unitprice = 'Prix Moyen d´Achat'
col_valuation = 'Valorisation des supports'
col_vdate = 'Date de valorisation'
col_portfolio_share = '(%)'
class item(ItemElement):
klass = Investment
obj_label = CleanText(TableCell('label'))
obj_quantity = CleanDecimal.French(TableCell('quantity'), default=NotAvailable)
obj_unitprice = CleanDecimal.French(TableCell('unitprice'), default=NotAvailable)
obj_valuation = CleanDecimal.French(TableCell('valuation'), default=NotAvailable)
obj_vdate = Date(CleanText(TableCell('vdate')), dayfirst=True)
obj_portfolio_share = Eval(lambda x: x / 100, CleanDecimal.French(TableCell('portfolio_share')))
def obj_code(self):
# 'href', 'alt' & 'title' attributes all contain the ISIN
isin = Attr(TableCell('label')(self)[0], 'title', default=NotAvailable)(self)
return IsinCode(default=NotAvailable).filter(isin)
obj_code_type = IsinType(Field('code'), default=NotAvailable)
class iter_history(ListElement):
# Historique des versements:
class iter_versements(ListElement):
item_xpath = '//fieldset[legend[text()="Historique des versements"]]/table/tr[@class!="place"]'
class item(ItemElement):
klass = Transaction
obj_date = Date(CleanText('.//td[3]'), dayfirst=True)
obj_label = Format('Versement %s', CleanText('.//td[4]'))
obj_amount = CleanDecimal.French('.//td[6]')
# Historique des Rachats partiels:
class iter_partial_repurchase(ListElement):
item_xpath = '//fieldset[legend[text()="Historique des Rachats partiels"]]/table/tr[@class!="place"]'
class item(ItemElement):
klass = Transaction
obj_date = Date(CleanText('.//td[3]'), dayfirst=True)
obj_label = Format('Rachat %s', CleanText('.//td[4]'))
obj_amount = CleanDecimal.French('.//td[5]')
# Historique des demandes d´avance:
class iter_advances(ListElement):
item_xpath = '//fieldset[legend[text()="Historique des demandes d´avance"]]/table/tr[@class!="place"]'
class item(ItemElement):
klass = Transaction
obj_date = Date(CleanText('.//td[3]'), dayfirst=True)
obj_label = Format('Demande d\'avance %s', CleanText('.//td[4]'))
obj_amount = CleanDecimal.French('.//td[5]')
- We do not fetch the "Historique des arbitrages" category
because the transactions have no available amount.
- The part below will crash if the remaining table is not empty:
it will be the occasion to implement the scraping of these transactions.
class iter_other(ListElement):
def parse(self, el):
texts = [
'Sécurisation des plus values',
for text in texts:
assert CleanText('.')(
)[0]), '%s is not handled' % text
class PortfolioPage(BasePage):
# we don't do anything here, but we might land here from a SSO like ing
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment