From 87778a7c5ffa58ac2dbde55648d14cd0850acfc6 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Thu, 25 Jul 2019 17:08:30 +0200 Subject: [PATCH] [boursorama] Skip checking coming transactions because 'date' disappeared MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before, the 'mes prélèvements à venir' tab contained a date in the './/time' xpath but it does not exist anymore, so we do not retrieve these transactions any longer. Closes: 44064@sibi --- modules/boursorama/browser.py | 16 +++++++--------- modules/boursorama/pages.py | 1 - 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/boursorama/browser.py b/modules/boursorama/browser.py index 4fb368365b..6b27d782b4 100644 --- a/modules/boursorama/browser.py +++ b/modules/boursorama/browser.py @@ -333,20 +333,18 @@ def get_history(self, account, coming=False): return self.get_regular_transactions(account, coming) def get_regular_transactions(self, account, coming): - # We look for 3 years of history. - params = {} - params['movementSearch[toDate]'] = (date.today() + relativedelta(days=40)).strftime('%d/%m/%Y') - params['movementSearch[fromDate]'] = (date.today() - relativedelta(years=3)).strftime('%d/%m/%Y') - params['movementSearch[selectedAccounts][]'] = account._webid if not coming: + # We look for 3 years of history. + params = {} + params['movementSearch[toDate]'] = (date.today() + relativedelta(days=40)).strftime('%d/%m/%Y') + params['movementSearch[fromDate]'] = (date.today() - relativedelta(years=3)).strftime('%d/%m/%Y') + params['movementSearch[selectedAccounts][]'] = account._webid self.location('%s/mouvements' % account.url.rstrip('/'), params=params) for transaction in self.page.iter_history(): yield transaction - elif account.type == Account.TYPE_CHECKING: - self.location('%s/mouvements-a-venir' % account.url.rstrip('/'), params=params) - for transaction in self.page.iter_history(coming=True): - yield transaction + # Note: Checking accounts have a 'Mes prélèvements à venir' tab, + # but these transactions have no date anymore so we ignore them. def get_card_transactions(self, account, coming): # All card transactions can be found in the CSV (history and coming), diff --git a/modules/boursorama/pages.py b/modules/boursorama/pages.py index 6306dbad58..63b3c84819 100644 --- a/modules/boursorama/pages.py +++ b/modules/boursorama/pages.py @@ -460,7 +460,6 @@ def next_page(self): class item(ItemElement): klass = Transaction - obj_date = Date(Attr('.//time', 'datetime')) obj_amount = CleanDecimal('.//div[has-class("list__movement__line--amount")]', replace_dots=True) obj_category = CleanText('.//span[has-class("category")]') obj__account_name = CleanText('.//span[contains(@class, "account__name-xs")]', default=None) -- GitLab