get more history
This commit is contained in:
parent
eeed606757
commit
a66bc85b45
2 changed files with 15 additions and 11 deletions
|
|
@ -19,6 +19,9 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from datetime import date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
|
||||
|
||||
from .pages.login import LoginPage
|
||||
|
|
@ -80,6 +83,13 @@ class Fortuneo(BaseBrowser):
|
|||
|
||||
def get_history(self, account):
|
||||
self.location(account._link_id)
|
||||
|
||||
self.select_form(name='ConsultationHistoriqueOperationsForm')
|
||||
self.set_all_readonly(False)
|
||||
self['dateRechercheDebut'] = (date.today() - relativedelta(years=1)).strftime('%d/%m/%Y')
|
||||
self['nbrEltsParPage'] = '100'
|
||||
self.submit()
|
||||
|
||||
return self.page.get_operations(account)
|
||||
|
||||
def get_accounts_list(self):
|
||||
|
|
|
|||
|
|
@ -57,20 +57,20 @@ class AccountHistoryPage(BasePage):
|
|||
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
|
||||
|
||||
# TODO need to rewrite that with FrenchTransaction class http://tinyurl.com/6lq4r9t
|
||||
operations = []
|
||||
tables = self.document.findall(".//*[@id='tabHistoriqueOperations']/tbody/tr")
|
||||
|
||||
if len(tables) == 0:
|
||||
return []
|
||||
return
|
||||
|
||||
for i in range(len(tables)):
|
||||
operation = Transaction(len(operations))
|
||||
operation = Transaction(i)
|
||||
operation.type = 0
|
||||
operation.category = NotAvailable
|
||||
|
||||
date_oper = tables[i].xpath("./td[2]/text()")[0]
|
||||
date_val = tables[i].xpath("./td[3]/text()")[0]
|
||||
label = tables[i].xpath("./td[4]/text()")[0]
|
||||
label = re.sub(r'[ \xa0]+', ' ', label).strip()
|
||||
amount = tables[i].xpath("./td[5]/text() | ./td[6]/text()")
|
||||
|
||||
operation.parse(date=date_val, raw=label)
|
||||
|
|
@ -83,9 +83,7 @@ class AccountHistoryPage(BasePage):
|
|||
|
||||
operation.set_amount(amount)
|
||||
|
||||
operations.append(operation)
|
||||
|
||||
return operations
|
||||
yield operation
|
||||
|
||||
class AccountsList(BasePage):
|
||||
def on_loaded(self):
|
||||
|
|
@ -122,8 +120,6 @@ class AccountsList(BasePage):
|
|||
return len(form) > 0
|
||||
|
||||
def get_list(self):
|
||||
l = []
|
||||
|
||||
for cpt in self.document.xpath(".//*[@class='synthese_id_compte']"):
|
||||
account = Account()
|
||||
|
||||
|
|
@ -158,9 +154,7 @@ class AccountsList(BasePage):
|
|||
temp_label = cpt.xpath('./text()')[1].replace(u'-\xa0', '').replace("\n", "").replace("\t", "")
|
||||
account.label = " ".join(temp_label.split(" ")[:2])
|
||||
|
||||
l.append(account)
|
||||
|
||||
return l
|
||||
yield account
|
||||
|
||||
class GlobalAccountsList(BasePage):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue