The account listing is now more robust
Hello, actually I didn't write this patch. The new contributor is David Jeanneteau. Regards, Florent. Signed-off-by: Florent <weboob@flo.fourcot.fr> Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
parent
30e3aa2038
commit
3fb8706d61
1 changed files with 13 additions and 9 deletions
|
|
@ -34,16 +34,20 @@ class AccountsList(BasePage):
|
||||||
|
|
||||||
def get_list(self):
|
def get_list(self):
|
||||||
l = []
|
l = []
|
||||||
|
ids = []
|
||||||
for td in self.document.xpath('.//td[@nowrap="nowrap"]'):
|
for td in self.document.xpath('.//td[@nowrap="nowrap"]'):
|
||||||
account = Account()
|
account = Account()
|
||||||
link = td.xpath('.//a')[0]
|
link = td.xpath('.//a')[0]
|
||||||
account.id = re.search('\d', link.attrib['href']).group(0)
|
account.id = re.search('\d', link.attrib['href']).group(0)
|
||||||
|
if not ( account.id in ids ) :
|
||||||
|
ids.append( account.id )
|
||||||
account.label = link.text
|
account.label = link.text
|
||||||
urltofind = './/a[@href="' + link.attrib['href'] + '"]'
|
urltofind = './/a[@href="' + link.attrib['href'] + '"]'
|
||||||
linkbis = self.document.xpath(urltofind).pop()
|
linkbis = self.document.xpath(urltofind).pop()
|
||||||
account.balance = float(linkbis.text.replace('.', '').replace(',','.'))
|
if linkbis.text == link.text :
|
||||||
|
linkbis=self.document.xpath(urltofind)[1]
|
||||||
|
account.balance = float( linkbis.text.replace('.','').replace(' ', '').replace(',','.') )
|
||||||
account.coming = NotAvailable
|
account.coming = NotAvailable
|
||||||
l.append(account)
|
l.append(account)
|
||||||
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue