Commit d4b7deb2 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[caissedepargne] Handle users who don't have access to Linebourse

Some users have a PEA but they don't have access to linebourse.
The self.page.is_error() was already handled in iter_accounts, but not
in iter_history() and iter_investments(), therefore some connections
were still crashing.

Closes: 32564@sibi
parent 1dfa6b25
......@@ -582,6 +582,10 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
if "Bourse" in self.url:
self.page.submit()
if 'offrebourse.com' in self.url:
# Some users may not have access to this.
if self.page.is_error():
return iter([])
self.linebourse.session.cookies.update(self.session.cookies)
self.update_linebourse_token()
return self.linebourse.iter_history(account.id)
......@@ -624,6 +628,10 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
self.page.submit()
if 'offrebourse.com' in self.url:
# Some users may not have access to this.
if self.page.is_error():
return
self.update_linebourse_token()
for investment in self.linebourse.iter_investments(account.id):
yield investment
......
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