Index is back for some accounts...

This commit is contained in:
Florent 2014-09-04 23:36:48 +02:00
commit 3076579747
2 changed files with 11 additions and 2 deletions

View file

@ -131,19 +131,25 @@ class IngBrowser(LoginBrowser):
if account.type == Account.TYPE_CHECKING:
history_function = AccountsList.get_transactions_cc
index = -1 # disable the index. It works without it on CC
else:
history_function = AccountsList.get_transactions_others
index = 0
hashlist = []
while True:
for transaction in history_function(self.page):
i = index
for transaction in history_function(self.page, index=index):
transaction.id = hashlib.md5(transaction._hash).hexdigest()
while transaction.id in hashlist:
transaction.id = hashlib.md5(transaction.id + "1").hexdigest()
hashlist.append(transaction.id)
i += 1
yield transaction
# if there is no more transactions, it is useless to continue
if self.page.islast():
if self.page.islast() or i == index:
return
if index >= 0:
index = i
data = {"AJAX:EVENTS_COUNT": 1,
"AJAXREQUEST": "_viewRoot",
"autoScroll": "",

View file

@ -149,6 +149,9 @@ class AccountsList(LoggedPage, HTMLPage):
def condition(self):
if self.el.find('.//td[@class="date"]') is None:
return False
if self.env['index'] > 0 and self.page.i < self.env['index']:
self.page.i += 1
return False
return True
@method