diff --git a/modules/lcl/browser.py b/modules/lcl/browser.py index 48743a717fbc88e74f8492c3fc693468a0c39fee..8aa2ff2d80e77db415014836c46d83536d26d4ca 100644 --- a/modules/lcl/browser.py +++ b/modules/lcl/browser.py @@ -415,19 +415,12 @@ def get_cb_operations(self, account, month=0): @need_login def get_investment(self, account): if account.type == Account.TYPE_LIFE_INSURANCE: - if not account._form: + if not account._external_website: self.logger.warning('This account is limited, there is no available investment.') return self.assurancevie.stay_or_go() - # The website often returns an error so we try again: - # "L’accès au service est momentanément indisponible." - try: - account._form.submit() - except BrowserUnavailable: - self.logger.warning("Service unavailable, we submit the form again.") - self.assurancevie.stay_or_go() - account._form.submit() + self.go_life_insurance_website() if self.calie.is_here(): for inv in self.page.iter_investment(): @@ -436,19 +429,11 @@ def get_investment(self, account): self.assurancevie.go() return - # Some users will get a message : "Ne détenant pas de compte dépôt - # chez LCL, l'accès à ce service vous est indisponible." - if self.form2.is_here() and self.page.assurancevie_hist_not_available(): - return - - self.avdetail.go() - self.av_investments.go() - + assert self.av_list.is_here(), 'Something went wrong during iter life insurance investments' + self.av_investments.go(life_insurance_id=account.id) for inv in self.page.iter_investment(): yield inv - - self.avdetail.go() - self.page.come_back() + self.go_back_from_life_insurance_website() elif hasattr(account, '_market_link') and account._market_link: self.connexion_bourse() diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index eb50aabff37d0331ca77c9fda06c6d90b8f9f73a..3015338945cb4d2cf4a5a4058abd28fc0c487869 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -945,18 +945,13 @@ class item(ItemElement): obj_unitvalue = CleanDecimal(Dict('mtliqpaaspt'), default=NotAvailable) obj_quantity = CleanDecimal(Dict('qtpaaspt'), default=NotAvailable) obj_diff = CleanDecimal(Dict('mtpmvspt'), default=NotAvailable) + obj_vdate = Date(Dict('dvspt'), default=NotAvailable) def obj_portfolio_share(self): ptf = CleanDecimal(Dict('txrpaspt'), default=NotAvailable)(self) ptf /= 100 return ptf - def obj_vdate(self): - time = Dict('dvspt')(self) - if not time: - return NotAvailable - return datetime.fromtimestamp(time//1000) - def obj_code_type(self): if is_isin_valid(Field('code')(self)): return Investment.CODE_TYPE_ISIN