diff --git a/modules/fortuneo/browser.py b/modules/fortuneo/browser.py index 8143d23d..477fb825 100644 --- a/modules/fortuneo/browser.py +++ b/modules/fortuneo/browser.py @@ -90,9 +90,10 @@ class Fortuneo(Browser): def get_history(self, account): self.location(account._link_id) - self.page.select_period() + if self.page.select_period(): + return self.page.get_operations(account) - return self.page.get_operations(account) + return ([]) def get_accounts_list(self): """accounts list""" diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index d2d2b117..6cbd1d54 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -25,6 +25,8 @@ from time import sleep from datetime import date from dateutil.relativedelta import relativedelta +from mechanize import FormNotFoundError + from weboob.capabilities.bank import Account, Investment from weboob.deprecated.browser import Page, BrowserIncorrectPassword from weboob.capabilities import NotAvailable @@ -91,7 +93,7 @@ class PeaHistoryPage(Page): return Decimal(value) def select_period(self): - pass + return True def get_operations(self, _id): return iter([]) @@ -132,11 +134,15 @@ class InvestmentHistoryPage(Page): def select_period(self): self.browser.location(self.url.replace('portefeuille-assurance-vie.jsp', 'operations/assurance-vie-operations.jsp')) - self.browser.select_form(name='OperationsForm') + try: + self.browser.select_form(name='OperationsForm') + except FormNotFoundError: + return False self.browser.set_all_readonly(False) self.browser['dateDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y') self.browser['nbrEltsParPage'] = '100' self.browser.submit() + return True def get_operations(self, _id): for tr in self.document.xpath('//table[@id="tableau_histo_opes"]/tbody/tr'): @@ -160,6 +166,8 @@ class AccountHistoryPage(Page): self.browser['nbrEltsParPage'] = '100' self.browser.submit() + return True + def get_operations(self, _id): """history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""