LCL: implement account listing

Signed-off-by: Pierre Mazière <pierre.maziere@gmail.com>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
Pierre Mazière 2011-03-06 23:47:53 +01:00 committed by Romain Bignon
commit a732a8a051
2 changed files with 19 additions and 4 deletions

View file

@ -46,9 +46,8 @@ class LCLBackend(BaseBackend, ICapBank):
yield account
def get_account(self, _id):
if not _id.isdigit():
raise AccountNotFound()
account = self.browser.get_account(_id)
with self.browser:
account = self.browser.get_account(_id)
if account:
return account
else:

View file

@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from weboob.capabilities.bank import Account
from weboob.tools.browser import BasePage
class LoginPage(BasePage):
@ -35,4 +36,19 @@ class FramePage(BasePage):
class AccountsPage(BasePage):
def get_list(self):
raise NotImplementedError()
l = []
for div in self.document.getiterator('div'):
if div.attrib.get('class')=="unCompte-CC" :
account = Account()
account.id = div.attrib.get('id').replace('-','')
for td in div.getiterator('td'):
if td.find("div") is not None and td.find("div").attrib.get('class') == 'libelleCompte':
account.label = td.find("div").text
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(',','.')
account.balance = float(balance)
account.link_id = td.find('a').attrib.get('href')
l.append(account)
return l