Commit e6978ad3 authored by Baptiste Delpey's avatar Baptiste Delpey Committed by Romain Bignon

[hsbc] card history: stop duplicating trasnactions

Pagination in CBOperations is doing the same thing.
<a> html elements with `fleche` class are the same than those whose href
contains `sessionid`

Closed: 6512@zendesk
parent e567a2f6
......@@ -310,10 +310,6 @@ class HSBC(LoginBrowser):
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:
......
......@@ -24,14 +24,14 @@ import re
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 @@ class Pagination(object):
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):
......
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