diff --git a/weboob/backends/cragr/browser.py b/weboob/backends/cragr/browser.py index 48a744f0..c057596d 100644 --- a/weboob/backends/cragr/browser.py +++ b/weboob/backends/cragr/browser.py @@ -42,6 +42,7 @@ class Cragr(BaseBrowser): 'https://[^/]+/accounting/listAccounts': pages.AccountsList, 'https://[^/]+/accounting/listOperations': pages.AccountsList, 'https://[^/]+/accounting/showAccountDetail.+': pages.AccountsList, + 'https://[^/]+/accounting/showMoreAccountOperations.*': pages.AccountsList, } BaseBrowser.__init__(self, *args, **kwargs) @@ -98,7 +99,18 @@ class Cragr(BaseBrowser): page_url = account.link_id operations_count = 0 while (page_url): + # 1st, go on the account page self.location('https://%s%s' % (self.DOMAIN, page_url)) + + # then, expand all history + # (it's not a next page, but more operation on one page) + # tested on CA centre + while True: + history_url = self.page.expand_history_page_url() + if not history_url : + break + self.location(history_url) + for page_operation in self.page.get_history(operations_count): operations_count += 1 yield page_operation diff --git a/weboob/backends/cragr/pages/accounts_list.py b/weboob/backends/cragr/pages/accounts_list.py index 464bfe00..50abbc0e 100644 --- a/weboob/backends/cragr/pages/accounts_list.py +++ b/weboob/backends/cragr/pages/accounts_list.py @@ -115,6 +115,19 @@ class AccountsList(CragrBasePage): def get_transfer_target_accounts(self): return self.get_transfer_accounts('numCompteBeneficiaire') + def expand_history_page_url(self): + """ + When on a page dedicated to list the history of a specific account (see + is_account_page), returns the link to expand the history with 25 more results, + or False if the link is not present. + """ + # tested on CA centre france + a = self.document.xpath('/html/body//div[@class="navlink"]//a[contains(text(), "Voir les 25 suivants")]') + if not a: + return False + else: + return a[0].get('href', '') + def next_page_url(self): """ When on a page dedicated to list the history of a specific account (see