revert changes to new BNP website which has been removed

This commit is contained in:
Romain Bignon 2011-10-04 11:02:16 +02:00
commit acbf167f8c
8 changed files with 91 additions and 97 deletions

View file

@ -39,17 +39,34 @@ class AccountsList(BasePage):
def get_list(self):
l = []
for tr in self.document.getiterator('tr'):
if not 'class' in tr.attrib and tr.find('td') is not None and tr.find('td').attrib.get('class', '') == 'typeTitulaire':
if tr.attrib.get('class', '') == 'comptes':
account = Account()
account.id = tr.xpath('.//td[@class="libelleCompte"]/input')[0].attrib['id'][len('libelleCompte'):]
account.label = tr.xpath('.//td[@class="libelleCompte"]/a')[0].text.strip()
for td in tr.getiterator('td'):
if td.attrib.get('headers', '').startswith('Numero_'):
id = td.text
account.id = ''.join(id.split(' ')).strip()
elif td.attrib.get('headers', '').startswith('Libelle_'):
a = td.findall('a')
label = unicode(a[0].text)
account.label = label.strip()
m = self.LINKID_REGEXP.match(a[0].attrib.get('href', ''))
if m:
account.link_id = m.group(1)
elif td.attrib.get('headers', '').startswith('Solde'):
a = td.findall('a')
balance = a[0].text
balance = balance.replace('.','').replace(',','.')
account.balance = float(balance)
elif td.attrib.get('headers', '').startswith('Avenir'):
a = td.findall('a')
# Some accounts don't have a "coming"
if len(a):
coming = a[0].text
coming = coming.replace('.','').replace(',','.')
account.coming = float(coming)
else:
account.coming = NotAvailable
tds = tr.findall('td')
account.balance = float(tds[3].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r'))
if tds[4].find('a') is not None:
account.coming = float(tds[4].find('a').text.replace('.','').replace(',','.').strip(u' \t\u20ac\xa0\n\r'))
else:
account.coming = NotAvailable
l.append(account)
if len(l) == 0:
@ -59,6 +76,3 @@ class AccountsList(BasePage):
if div.text.strip() == 'Vous avez atteint la date de fin de vie de votre code secret.':
raise PasswordExpired(div.text.strip())
return l
def get_execution_id(self):
return self.document.xpath('//input[@name="execution"]')[0].attrib['value']