From 5671af33de300e61dd8cec07854617196434dd32 Mon Sep 17 00:00:00 2001 From: Dorian Roly Date: Wed, 11 Dec 2019 12:00:33 +0100 Subject: [PATCH] [bred] Fix error when there is too many transactions in one account When you try to get transactions from the 10000th you have to reset to 0 and change the last_date to continue --- modules/bred/bred/browser.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/bred/bred/browser.py b/modules/bred/bred/browser.py index 8e7e4ee062..57897b6b48 100644 --- a/modules/bred/bred/browser.py +++ b/modules/bred/bred/browser.py @@ -180,17 +180,25 @@ def get_history(self, account, coming=False): seen = set() offset = 0 next_page = True + end_date = date.today() + last_date = None while next_page: + if offset == 10000: + offset = 0 + end_date = last_date operation_list = self._make_api_call( account=account, - start_date=date(day=1, month=1, year=2000), end_date=date.today(), + start_date=date(day=1, month=1, year=2000), end_date=end_date, offset=offset, max_length=50, ) transactions = self.page.iter_history(account=account, operation_list=operation_list, seen=seen, today=today, coming=coming) + transactions = sorted_transactions(transactions) + if transactions: + last_date = transactions[-1].date # Transactions are unsorted - for t in sorted_transactions(transactions): + for t in transactions: if coming == t._coming: yield t elif coming and not t._coming: -- GitLab