The new woob repository is here: https://gitlab.com/woob/woob. 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,
HomePage,
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(
r'/priv/asVieSituationEncours.php',
r'/priv/encours.php\?nc=\d+&idUnique=[\dA-F-]+',
LifeInsurancePage
)
isin_page = URL(r'/fr/marche/', IsinPage)
js_redirect = URL(r'/priv/fiche-valeur.php', JsRedirectPage)
......@@ -77,14 +71,6 @@ def do_login(self):
@need_login
def iter_accounts(self):
for account in self.iter_accounts_but_insurances():
yield account
self.lifeinsurance.go()
if self.lifeinsurance.is_here() and self.page.has_account():
yield self.page.get_account()
def iter_accounts_but_insurances(self):
self.accounts.go()
for account in self.page.iter_accounts():
self.accounts.go(nc=account._select)
......@@ -93,18 +79,12 @@ def iter_accounts_but_insurances(self):
@need_login
def iter_investment(self, account):
if account.type == account.TYPE_LIFE_INSURANCE:
self.accounts.go()
self.lifeinsurance.go()
for inv in self.page.iter_investment():
yield inv
else:
self.pre_invests.go(nc=account._select)
self.invests.go()
self.pre_invests.go(nc=account._select)
self.invests.go()
for inv in self.page.iter_investment():
yield inv
yield self.page.get_liquidity()
for inv in self.page.iter_investment():
yield inv
yield self.page.get_liquidity()
@need_login
def iter_market_orders(self, account):
......@@ -125,9 +105,7 @@ def iter_market_orders(self, account):
@need_login
def iter_history(self, account):
if account.type == account.TYPE_LIFE_INSURANCE:
self.lifeinsurance.go()
elif account.type in (account.TYPE_MARKET, account.TYPE_PEA):
if account.type in (account.TYPE_MARKET, account.TYPE_PEA):
self.history.go(nc=account._select)
else:
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
@method
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)',
CleanText('//label[text()="Nom"]/following-sibling::b[1]'),
CleanText('//label[text()="Produit"]/following-sibling::b[1]'),
)
obj_type = Account.TYPE_LIFE_INSURANCE
@method
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)
@method
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('.')(self.page.doc.xpath(
'//fieldset[legend[text()=$text]]//div[@class="noRecord"]',
text=text,
)[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
pass
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