Support all the history
Ugly code...
This commit is contained in:
parent
95c41a346f
commit
3d532ef501
2 changed files with 29 additions and 7 deletions
|
|
@ -121,19 +121,26 @@ class Ing(BaseBrowser):
|
||||||
}
|
}
|
||||||
self.location(self.accountspage, urllib.urlencode(data))
|
self.location(self.accountspage, urllib.urlencode(data))
|
||||||
self.where = "history"
|
self.where = "history"
|
||||||
|
jid = self.page.get_history_jid()
|
||||||
|
i = 0 # index, we get always the same page, but with more informations
|
||||||
while 1:
|
while 1:
|
||||||
hashlist = []
|
hashlist = []
|
||||||
for transaction in self.page.get_transactions():
|
for transaction in self.page.get_transactions(i):
|
||||||
while transaction.id in hashlist:
|
while transaction.id in hashlist:
|
||||||
transaction.id = hashlib.md5(transaction.id + "1").hexdigest()
|
transaction.id = hashlib.md5(transaction.id + "1").hexdigest()
|
||||||
hashlist.append(transaction.id)
|
hashlist.append(transaction.id)
|
||||||
|
i += 1
|
||||||
yield transaction
|
yield transaction
|
||||||
if self.page.islast():
|
if self.page.islast():
|
||||||
return
|
return
|
||||||
|
data = {"AJAX:EVENTS_COUNT": 1,
|
||||||
# XXX server sends an unknown mimetype, we overload
|
"AJAXREQUEST": "_viewRoot",
|
||||||
# viewing_html() above to prevent this issue.
|
"autoScroll": "",
|
||||||
self.page.next_page()
|
"index": "index",
|
||||||
|
"index:%s:moreTransactions" % jid: "index:%s:moreTransactions" % jid,
|
||||||
|
"javax.faces.ViewState": account._jid
|
||||||
|
}
|
||||||
|
self.location(self.accountspage, urllib.urlencode(data))
|
||||||
|
|
||||||
def get_recipients(self, account):
|
def get_recipients(self, account):
|
||||||
if not self.is_on_page(TransferPage):
|
if not self.is_on_page(TransferPage):
|
||||||
|
|
@ -184,6 +191,7 @@ class Ing(BaseBrowser):
|
||||||
yield bill
|
yield bill
|
||||||
if self.page.islast():
|
if self.page.islast():
|
||||||
return
|
return
|
||||||
|
|
||||||
self.page.next_page()
|
self.page.next_page()
|
||||||
|
|
||||||
def predownload(self, bill):
|
def predownload(self, bill):
|
||||||
|
|
|
||||||
|
|
@ -72,12 +72,17 @@ class AccountsList(BasePage):
|
||||||
account._jid = jid.attrib['value']
|
account._jid = jid.attrib['value']
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
def get_transactions(self):
|
def get_transactions(self, index):
|
||||||
|
i = 0
|
||||||
for table in self.document.xpath('//table[@cellpadding="0"]'):
|
for table in self.document.xpath('//table[@cellpadding="0"]'):
|
||||||
try:
|
try:
|
||||||
textdate = table.find('.//td[@class="elmt tdate"]').text_content()
|
textdate = table.find('.//td[@class="elmt tdate"]').text_content()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
|
# Do not parse transactions already parsed
|
||||||
|
if i < index:
|
||||||
|
i += 1
|
||||||
|
continue
|
||||||
if textdate == 'hier':
|
if textdate == 'hier':
|
||||||
textdate = (date.today() - timedelta(days=1)).strftime('%d/%m/%Y')
|
textdate = (date.today() - timedelta(days=1)).strftime('%d/%m/%Y')
|
||||||
elif textdate == "aujourd'hui":
|
elif textdate == "aujourd'hui":
|
||||||
|
|
@ -102,5 +107,14 @@ class AccountsList(BasePage):
|
||||||
op.amount = Decimal(amount)
|
op.amount = Decimal(amount)
|
||||||
yield op
|
yield op
|
||||||
|
|
||||||
|
def get_history_jid(self):
|
||||||
|
span = self.document.xpath('//span[starts-with(@id, "index:j_id")]')[0]
|
||||||
|
jid = span.attrib['id'].split(':')[1]
|
||||||
|
return jid
|
||||||
|
|
||||||
def islast(self):
|
def islast(self):
|
||||||
return True
|
nomore = self.document.xpath('//span[@class="no-more-transactions"]')
|
||||||
|
if len(nomore) > 0:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue