From e6978ad3b63443d41004297ec6fe60e204ed2ee1 Mon Sep 17 00:00:00 2001 From: Baptiste Delpey Date: Wed, 8 Aug 2018 14:32:01 +0200 Subject: [PATCH] [hsbc] card history: stop duplicating trasnactions Pagination in CBOperations is doing the same thing. html elements with `fleche` class are the same than those whose href contains `sessionid` Closed: 6512@zendesk --- modules/hsbc/browser.py | 4 ---- modules/hsbc/pages/account_pages.py | 11 ++--------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/modules/hsbc/browser.py b/modules/hsbc/browser.py index 565ea0beab..07058beeed 100644 --- a/modules/hsbc/browser.py +++ b/modules/hsbc/browser.py @@ -310,10 +310,6 @@ def get_history(self, account, coming=False, retry_li=True): if self.cbPage.is_here(): guesser = LinearDateGuesser(date_max_bump=timedelta(45)) history = list(self.page.get_history(date_guesser=guesser)) - for url, params in self.page.get_params(self.url): - self.location(url, params=params) - if self.cbPage.is_here(): - history.extend(self.page.get_history(date_guesser=guesser)) for tr in history: if tr.type == tr.TYPE_UNKNOWN: diff --git a/modules/hsbc/pages/account_pages.py b/modules/hsbc/pages/account_pages.py index c51ba3a1ad..4eeb00d4ca 100644 --- a/modules/hsbc/pages/account_pages.py +++ b/modules/hsbc/pages/account_pages.py @@ -24,14 +24,14 @@ from weboob.capabilities import NotAvailable from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction -from weboob.tools.compat import urlparse, parse_qs, urljoin +from weboob.tools.compat import urljoin from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, ActionNeeded from weboob.browser.elements import ListElement, ItemElement, method from weboob.browser.pages import HTMLPage, pagination from weboob.browser.filters.standard import ( Filter, Env, CleanText, CleanDecimal, Field, DateGuesser, Regexp ) -from weboob.browser.filters.html import Link, AbsoluteLink, TableCell +from weboob.browser.filters.html import AbsoluteLink, TableCell from weboob.browser.filters.javascript import JSVar from .landing_pages import GenericLandingPage @@ -201,13 +201,6 @@ def next_page(self): class CBOperationPage(GenericLandingPage): is_here = '//h1[text()="Historique des opérations"]' - def get_params(self, url): - parsed = urlparse(url) - base_url, params = parsed.path, parse_qs(parsed.query) - for a in self.doc.xpath('//form[@name="FORM_LIB_CARTE"]//a[contains(@href, "sessionid")]'): - params['sessionid'] = parse_qs(urlparse(Link('.')(a)).query)['sessionid'] - yield base_url, params - @pagination @method class get_history(Pagination, Transaction.TransactionsElement): -- GitLab