Get more historical transactions
We get now all availables transactions on the website, not only the first page
This commit is contained in:
parent
d095811799
commit
ae3ccde2e8
2 changed files with 33 additions and 10 deletions
|
|
@ -91,7 +91,11 @@ class Ing(BaseBrowser):
|
||||||
self.location('https://secure.ingdirect.fr/general?command=goToAccount&account=%d&zone=COMPTE' % int(id))
|
self.location('https://secure.ingdirect.fr/general?command=goToAccount&account=%d&zone=COMPTE' % int(id))
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
return self.page.get_transactions()
|
while 1:
|
||||||
|
for transaction in self.page.get_transactions():
|
||||||
# TODO
|
yield transaction
|
||||||
# def get_coming_operations
|
if self.page.islast():
|
||||||
|
return
|
||||||
|
self.page.next_page()
|
||||||
|
# The answer is not a valide html page for mechanize, we have to be tolerant
|
||||||
|
self._factory.is_html = True
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from decimal import Decimal
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
|
from weboob.tools.mech import ClientForm
|
||||||
from weboob.capabilities.bank import Transaction
|
from weboob.capabilities.bank import Transaction
|
||||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||||
|
|
||||||
|
|
@ -47,15 +48,33 @@ class AccountHistory(BasePage):
|
||||||
i = 1
|
i = 1
|
||||||
for tr in table.xpath('tr'):
|
for tr in table.xpath('tr'):
|
||||||
id = i
|
id = i
|
||||||
texte = tr.text_content().split('\n')
|
|
||||||
op = Transaction(id)
|
op = Transaction(id)
|
||||||
op.parse(date = date(*reversed([int(x) for x in texte[0].split('/')])),
|
textdate = tr.find('td[@class="op_date"]').text_content()
|
||||||
raw = texte[2])
|
textraw = tr.find('td[@class="op_label"]').text_content()
|
||||||
|
op.parse(date = date(*reversed([int(x) for x in textdate.split('/')])),
|
||||||
|
raw = textraw)
|
||||||
# force the use of website category
|
# force the use of website category
|
||||||
op.category = texte[4]
|
op.category = unicode(tr.find('td[@class="op_type"]').text)
|
||||||
|
|
||||||
op.amount = Decimal(op.clean_amount(texte[5]))
|
op.amount = Decimal(op.clean_amount(tr.find('td[@class="op_amount"]').text_content()))
|
||||||
print "coin"
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
yield op
|
yield op
|
||||||
|
|
||||||
|
def islast(self):
|
||||||
|
form = self.document.find('//form[@id="navigation_form"]')
|
||||||
|
alinks = form.xpath('div/a')
|
||||||
|
for a in alinks:
|
||||||
|
if u'Page Suivante' in a.text:
|
||||||
|
self.next = a.attrib['id']
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
def next_page(self):
|
||||||
|
self.browser.select_form('navigation_form')
|
||||||
|
self.browser.set_all_readonly(False)
|
||||||
|
self.browser.controls.append(ClientForm.TextControl('text', 'AJAXREQUEST', {'value': ''}))
|
||||||
|
self.browser['AJAXREQUEST'] = '_viewRoot'
|
||||||
|
self.browser.controls.append(ClientForm.TextControl('text', self.next, {'value': ''}))
|
||||||
|
self.browser[self.next] = self.next
|
||||||
|
self.browser.submit()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue