Commit eb80d54a authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by ntome

[bred] Skip transaction duplicates

The website sometimes send us duplicates transactions that erase other
transactions. There is nothing we can do to fix that, so we just skip
those duplicates instead of raising an error.

Closes: 18569@sibi 13059,13204,13337,13751@zendesk
parent 0ceb3e67
......@@ -198,7 +198,7 @@ class BredBrowser(LoginBrowser):
self.logger.debug('stopping coming after %s', t)
return
next_page = len(transactions) == 50
next_page = len(transactions) > 0
offset += 50
# This assert supposedly prevents infinite loops,
......
......@@ -24,7 +24,7 @@ from datetime import date
from decimal import Decimal
from weboob.tools.date import parse_french_date
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, ActionNeeded, ParseError
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable, ActionNeeded
from weboob.capabilities.base import find_object
from weboob.browser.pages import JsonPage, LoggedPage, HTMLPage
from weboob.capabilities import NotAvailable
......@@ -264,7 +264,8 @@ class SearchPage(LoggedPage, JsonPage):
t = Transaction()
t.id = str(op['id'])
if op['id'] in seen:
raise ParseError('There are several transactions with the same ID, probably an infinite loop')
self.logger.debug('Skipped transaction : "%s %s"' % (op['id'], op['libelle']))
continue
seen.add(t.id)
d = date.fromtimestamp(op.get('dateDebit', op.get('dateOperation')) / 1000)
......
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