Commit a5f282c9 authored by ntome's avatar ntome Committed by Romain Bignon

[axabanque] when accounts has no detailed investments, just return empty

The site just reports the portfolio share, not even the amount. Return
an empty list instead of too sparse data.
parent 0281874f
Pipeline #175 failed with stages
in 9 minutes and 34 seconds
......@@ -159,6 +159,10 @@ class AXABanque(AXABrowser):
invs = list(self.page.iter_investment())
elif account._acctype == "investment":
investment_link = self.location(account._link).page.get_investment_link()
if investment_link is None:
self.logger.warning('no investment link for account %s, returning empty', account)
# fake data, don't cache it
return []
invs = list(self.location(investment_link).page.iter_investment())
self.cache['invs'][account.id] = invs
return self.cache['invs'][account.id]
......
......@@ -94,7 +94,7 @@ class HistoryPage(LoggedPage, HTMLPage):
return super(HistoryPage, self).build_doc(content)
def get_investment_link(self):
return Attr('//article[has-class("card-distribution")]', 'data-url')(self.doc)
return Attr('//article[has-class("card-distribution")]', 'data-url', default=None)(self.doc)
def get_pagination_link(self):
return Attr('//div[has-class("default")][@data-current-page]', 'data-url')(self.doc)
......
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