fix indent
This commit is contained in:
parent
e14af3b890
commit
34db067da4
3 changed files with 53 additions and 53 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010 Romain Bignon
|
# Copyright(C) 2010-2011 Romain Bignon, Pierre Mazière
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -58,7 +58,7 @@ class LCLBackend(BaseBackend, ICapBank):
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
||||||
def iter_history(self, account):
|
def iter_history(self, account):
|
||||||
with self.browser:
|
with self.browser:
|
||||||
for history in self.browser.get_history(account):
|
for history in self.browser.get_history(account):
|
||||||
yield history
|
yield history
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010 Romain Bignon
|
# Copyright(C) 2010-2011 Romain Bignon, Pierre Mazière
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -75,9 +75,9 @@ class LCLBrowser(BaseBrowser):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_history(self,account):
|
def get_history(self,account):
|
||||||
if not self.is_on_page(AccountHistoryPage) :
|
if not self.is_on_page(AccountHistoryPage) :
|
||||||
self.location('%s://%s%s' % (self.PROTOCOL, self.DOMAIN, account.link_id))
|
self.location('%s://%s%s' % (self.PROTOCOL, self.DOMAIN, account.link_id))
|
||||||
return self.page.get_operations()
|
return self.page.get_operations()
|
||||||
|
|
||||||
#def get_coming_operations(self, account):
|
#def get_coming_operations(self, account):
|
||||||
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010 Romain Bignon
|
# Copyright(C) 2010-2011 Romain Bignon, Pierre Mazière
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -38,53 +38,53 @@ class FramePage(BasePage):
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
l = []
|
l = []
|
||||||
for div in self.document.getiterator('div'):
|
for div in self.document.getiterator('div'):
|
||||||
if div.attrib.get('class')=="unCompte-CC" :
|
if div.attrib.get('class')=="unCompte-CC" :
|
||||||
account = Account()
|
account = Account()
|
||||||
account.id = div.attrib.get('id').replace('-','')
|
account.id = div.attrib.get('id').replace('-','')
|
||||||
for td in div.getiterator('td'):
|
for td in div.getiterator('td'):
|
||||||
if td.find("div") is not None and td.find("div").attrib.get('class') == 'libelleCompte':
|
if td.find("div") is not None and td.find("div").attrib.get('class') == 'libelleCompte':
|
||||||
account.label = td.find("div").text
|
account.label = td.find("div").text
|
||||||
elif td.find('a') is not None and td.find('a').attrib.get('class') is None:
|
elif td.find('a') is not None and td.find('a').attrib.get('class') is None:
|
||||||
balance = td.find('a').text.replace(u"\u00A0",'').replace('.','').replace('+','').replace(',','.')
|
balance = td.find('a').text.replace(u"\u00A0",'').replace('.','').replace('+','').replace(',','.')
|
||||||
account.balance = float(balance)
|
account.balance = float(balance)
|
||||||
account.link_id = td.find('a').attrib.get('href')
|
account.link_id = td.find('a').attrib.get('href')
|
||||||
|
|
||||||
l.append(account)
|
l.append(account)
|
||||||
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
class AccountHistoryPage(BasePage):
|
class AccountHistoryPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
self.operations = []
|
self.operations = []
|
||||||
done=False
|
done=False
|
||||||
for table in self.document.getiterator('table'):
|
for table in self.document.getiterator('table'):
|
||||||
title_tr=table.find('tr')
|
title_tr=table.find('tr')
|
||||||
if title_tr is None:
|
if title_tr is None:
|
||||||
continue
|
continue
|
||||||
for text in title_tr.itertext():
|
for text in title_tr.itertext():
|
||||||
prefix='Opérations effectuées'
|
prefix='Opérations effectuées'
|
||||||
if text.startswith(prefix.decode('utf-8')):
|
if text.startswith(prefix.decode('utf-8')):
|
||||||
for tr in table.iter('tr'):
|
for tr in table.iter('tr'):
|
||||||
tr_class=tr.attrib.get('class')
|
tr_class=tr.attrib.get('class')
|
||||||
if tr_class == 'tbl1' or tr_class=='tbl2':
|
if tr_class == 'tbl1' or tr_class=='tbl2':
|
||||||
tds=tr.findall('td')
|
tds=tr.findall('td')
|
||||||
d=date(*reversed([int(x) for x in tds[0].text.split('/')]))
|
d=date(*reversed([int(x) for x in tds[0].text.split('/')]))
|
||||||
label=u''+tds[1].find('a').text.strip()
|
label=u''+tds[1].find('a').text.strip()
|
||||||
if tds[3].text.strip() != u"":
|
if tds[3].text.strip() != u"":
|
||||||
amount = - float(tds[3].text.strip().replace('.','').replace(',','.').replace(u"\u00A0",'').replace(' ',''))
|
amount = - float(tds[3].text.strip().replace('.','').replace(',','.').replace(u"\u00A0",'').replace(' ',''))
|
||||||
else:
|
else:
|
||||||
amount= float(tds[4].text.strip().replace('.','').replace(',','.').replace(u"\u00A0",'').replace(' ',''))
|
amount= float(tds[4].text.strip().replace('.','').replace(',','.').replace(u"\u00A0",'').replace(' ',''))
|
||||||
operation=Operation(len(self.operations))
|
operation=Operation(len(self.operations))
|
||||||
operation.date=d
|
operation.date=d
|
||||||
operation.label=label
|
operation.label=label
|
||||||
operation.amount=amount
|
operation.amount=amount
|
||||||
self.operations.append(operation)
|
self.operations.append(operation)
|
||||||
done=True
|
done=True
|
||||||
break
|
break
|
||||||
if done:
|
if done:
|
||||||
break
|
break
|
||||||
|
|
||||||
def get_operations(self):
|
def get_operations(self):
|
||||||
return self.operations
|
return self.operations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue