Commit e3573f52 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[apivie] Fetch Account.opening_date

parent e8f11c4d
......@@ -72,7 +72,15 @@ class ApivieBrowser(LoginBrowser):
@retry(BrowserUnavailable, tries=3)
def iter_accounts(self):
self.accounts.go(api_url=self.APIURL)
return self.page.iter_accounts()
for account in self.page.iter_accounts():
try:
self.investments.go(api_url=self.APIURL, account_id=account.id)
except (ReadTimeoutError, ClientError) as e:
self.logger.warning('Error when trying to access account details: %s', e)
pass
else:
account.opening_date = self.page.get_opening_date()
yield account
@need_login
@retry(BrowserUnavailable, tries=3)
......
......@@ -118,6 +118,12 @@ class InvestmentPage(LoggedPage, JsonPage):
return NotAvailable
return int(srri)
def get_opening_date(self):
return Date(
CleanText(Dict('dateEffet')),
default=NotAvailable
)(self.doc)
class Transaction(FrenchTransaction):
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