예제 #1
0
    def get_accounts_list(self):

        #Parse CCP
        compte_table = self.document.xpath("//table[@id='comptes']", smart_strings=False)[0]
        compte_ligne = compte_table.xpath("./tbody/tr")

        for compte in compte_ligne:
            account = Account()
            tp = compte.xpath("./td/a")[0]
            account.label = tp.text
            account.link_id = tp.get("href")
            account.id = compte.xpath("./td")[1].text
            account.balance = float(''.join( compte.xpath("./td/span")[0].text.replace('.','').replace(',','.').split() ))
            self.Account_List.append(account)

        #Parse epargne
        epargne_table = self.document.xpath("//table[@id='comptesEpargne']", smart_strings=False)[0]
        epargne_ligne = epargne_table.xpath("./tbody/tr")

        for epargne in epargne_ligne:
            account = Account()
            tp = epargne.xpath("./td/a")[0]
            account.label = tp.text
            account.link_id = tp.get("href")
            account.id = epargne.xpath("./td")[1].text
            account.balance = float(''.join( epargne.xpath("./td/span")[0].text.replace('.','').replace(',','.').split() ) )
            self.Account_List.append(account)

        return self.Account_List
예제 #2
0
    def get_list(self):
        """
            Returns the list of available bank accounts
        """
        l = []

        for div in self.document.getiterator('div'):
            if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag in ('a', 'br'):
                account = Account()
                if div.getchildren()[0].tag == 'a':
                    # This is at least present on CA Nord-Est
                    account.label = ' '.join(div.find('a').text.split()[:-1])
                    account.link_id = div.find('a').get('href', '')
                    account.id = div.find('a').text.split()[-1]
                    s = div.find('div').find('b').find('span').text
                else:
                    # This is at least present on CA Toulouse
                    account.label = div.find('a').text.strip()
                    account.link_id = div.find('a').get('href', '')
                    account.id = div.findall('br')[1].tail.strip()
                    s = div.find('div').find('span').find('b').text
                balance = u''
                for c in s:
                    if c.isdigit():
                        balance += c
                    if c == ',':
                        balance += '.'
                account.balance = float(balance)
                l.append(account)
        return l
예제 #3
0
파일: pages.py 프로젝트: jocelynj/weboob
 def get_list(self):
     l = []
     
     for tr in self.document.getiterator('tr'):
         first_td = tr.getchildren()[0]
         if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g':
             account = Account()
             account.label = first_td.find('a').text
             account.link_id = first_td.find('a').get('href', '')
             account.id = first_td.find('a').text.split(' ')[0]+first_td.find('a').text.split(' ')[1]
             s = tr.getchildren()[2].text
             balance = u''
             for c in s:
                 if c.isdigit():
                     balance += c
                 if c == ',':
                     balance += '.'
             account.balance = float(balance)
             l.append(account)
         #raise NotImplementedError()
     return l
예제 #4
0
    def get_list(self):
        l = []
        for tr in self.document.getiterator('tr'):
            if tr.attrib.get('class', '') == 'comptes':
                account = Account()
                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

                l.append(account)

        if len(l) == 0:
            # oops, no accounts? check if we have not exhausted the allowed use
            # of this password
            for div in self.document.getroot().cssselect('div.Style_texte_gras'):
                if div.text.strip() == 'Vous avez atteint la date de fin de vie de votre code secret.':
                    raise PasswordExpired(div.text.strip())
        return l