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:
parent
360a2ce3b5
commit
a732a8a051
2 changed files with 19 additions and 4 deletions
|
|
@ -46,9 +46,8 @@ class LCLBackend(BaseBackend, ICapBank):
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
def get_account(self, _id):
|
def get_account(self, _id):
|
||||||
if not _id.isdigit():
|
with self.browser:
|
||||||
raise AccountNotFound()
|
account = self.browser.get_account(_id)
|
||||||
account = self.browser.get_account(_id)
|
|
||||||
if account:
|
if account:
|
||||||
return account
|
return account
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
from weboob.capabilities.bank import Account
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
|
|
@ -35,4 +36,19 @@ class FramePage(BasePage):
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
def get_list(self):
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue