当前位置: 首页>>代码示例>>Python>>正文


Python Account.label方法代码示例

本文整理汇总了Python中weboob.capabilities.bank.Account.label方法的典型用法代码示例。如果您正苦于以下问题:Python Account.label方法的具体用法?Python Account.label怎么用?Python Account.label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weboob.capabilities.bank.Account的用法示例。


在下文中一共展示了Account.label方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_accounts_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_accounts_list(self):
        r = self.api_open("/transactionnel/services/rest/Account/accounts")

        for content in r.json()["content"]:
            if self.accnum != "00000000000" and content["numero"] != self.accnum:
                continue
            for poste in content["postes"]:
                a = Account()
                a._number = content["numeroLong"]
                a._nature = poste["codeNature"]
                a._consultable = poste["consultable"]
                a.id = "%s.%s" % (a._number, a._nature)
                a.type = self.ACCOUNT_TYPES.get(poste["codeNature"], Account.TYPE_UNKNOWN)

                if "numeroDossier" in poste and poste["numeroDossier"]:
                    a._file_number = poste["numeroDossier"]
                    a.id += ".%s" % a._file_number

                if poste["postePortefeuille"]:
                    a.label = u"Portefeuille Titres"
                    a.balance = Decimal(str(poste["montantTitres"]["valeur"]))
                    a.currency = poste["montantTitres"]["monnaie"]["code"].strip()
                    yield a

                if "libelle" not in poste:
                    continue

                a.label = " ".join([content["intitule"].strip(), poste["libelle"].strip()])
                a.balance = Decimal(str(poste["solde"]["valeur"]))
                a.currency = poste["solde"]["monnaie"]["code"].strip()
                yield a
开发者ID:nojhan,项目名称:weboob-devel,代码行数:33,代码来源:browser.py

示例2: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        account_type = Account.TYPE_UNKNOWN
        accounts = []

        for tr in self.document.xpath('//table[@class="ecli"]/tr'):
            if tr.attrib.get('class', '') == 'entete':
                account_type = self.ACCOUNT_TYPES.get(tr.find('th').text.strip(), Account.TYPE_UNKNOWN)
                continue

            tds = tr.findall('td')

            balance = tds[-1].text.strip()
            if balance == '':
                continue

            account = Account()
            account.label = u' '.join([txt.strip() for txt in tds[0].itertext()])
            account.label = re.sub(u'[ \xa0\u2022\r\n\t]+', u' ', account.label).strip()
            account.id = re.findall('(\d+)', account.label)[0]
            account.balance = Decimal(FrenchTransaction.clean_amount(balance))
            account.currency = account.get_currency(balance)
            account.type = account_type
            m = re.search(r"javascript:submitForm\(([\w_]+),'([^']+)'\);", tds[0].find('a').attrib['onclick'])
            if not m:
                self.logger.warning('Unable to find link for %r' % account.label)
                account._link = None
            else:
                account._link = m.group(2)

            accounts.append(account)

        return accounts
开发者ID:Boussadia,项目名称:weboob,代码行数:34,代码来源:pages.py

示例3: get_accounts_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_accounts_list(self):
        r = self.open('/transactionnel/services/rest/Account/accounts')

        for content in r.json()['content']:
            if self.accnum != '00000000000' and content['numero'] != self.accnum:
                continue
            for poste in content['postes']:
                a = Account()
                a._number = content['numeroLong']
                a._nature = poste['codeNature']
                a._consultable = poste['consultable']
                a.id = '%s.%s' % (a._number, a._nature)
                a.type = self.ACCOUNT_TYPES.get(poste['codeNature'], Account.TYPE_UNKNOWN)

                if poste['postePortefeuille']:
                    a.label = u'Portefeuille Titres'
                    a.balance = Decimal(str(poste['montantTitres']['valeur']))
                    a.currency = poste['montantTitres']['monnaie']['code']
                    yield a

                if not 'libelle' in poste:
                    continue

                a.label = ' '.join([content['intitule'].strip(), poste['libelle'].strip()])
                a.balance = Decimal(str(poste['solde']['valeur']))
                a.currency = poste['solde']['monnaie']['code']
                yield a
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:29,代码来源:browser.py

示例4: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        r = self.api_open('/transactionnel/services/rest/Account/accounts')

        for content in r.json()['content']:
            if self.accnum != '00000000000' and content['numero'] != self.accnum:
                continue
            for poste in content['postes']:
                a = Account()
                a._number = content['numeroLong']
                iban_response = self.api_open('/transactionnel/services/rest/Account/account/%s/iban' % a._number).json()
                a.iban = iban_response['content']['iban'] if 'content' in iban_response else NotAvailable
                a._nature = poste['codeNature']
                a._consultable = poste['consultable']
                a._univers = self.current_univers
                a.id = '%s.%s' % (a._number, a._nature)
                a.type = self.ACCOUNT_TYPES.get(poste['codeNature'], Account.TYPE_UNKNOWN)

                if 'numeroDossier' in poste and poste['numeroDossier']:
                    a._file_number = poste['numeroDossier']
                    a.id += '.%s' % a._file_number

                if poste['postePortefeuille']:
                    a.label = u'Portefeuille Titres'
                    a.balance = Decimal(str(poste['montantTitres']['valeur']))
                    a.currency = poste['montantTitres']['monnaie']['code'].strip()
                    yield a

                if 'libelle' not in poste:
                    continue

                a.label = ' '.join([content['intitule'].strip(), poste['libelle'].strip()])
                a.balance = Decimal(str(poste['solde']['valeur']))
                a.currency = poste['solde']['monnaie']['code'].strip()
                yield a
开发者ID:ffourcot,项目名称:weboob,代码行数:36,代码来源:browser.py

示例5: get_accounts_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    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
开发者ID:jocelynj,项目名称:weboob,代码行数:31,代码来源:accountlist.py

示例6: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    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
开发者ID:jocelynj,项目名称:weboob,代码行数:32,代码来源:accounts_list.py

示例7: get_loan_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_loan_list(self):
        accounts = OrderedDict()

        # Old website
        for tr in self.doc.xpath('//table[@cellpadding="1"]/tr[not(@class) and td[a]]'):
            tds = tr.findall('td')

            account = Account()
            account.id = CleanText('./a')(tds[2]).split('-')[0].strip()
            account.label = CleanText('./a')(tds[2]).split('-')[-1].strip()
            account.type = Account.TYPE_LOAN
            account.balance = -CleanDecimal('./a', replace_dots=True)(tds[4])
            account.currency = account.get_currency(CleanText('./a')(tds[4]))
            accounts[account.id] = account

        if len(accounts) == 0:
            # New website
            for table in self.doc.xpath('//div[@class="panel"]'):
                title = table.getprevious()
                if title is None:
                    continue
                account_type = self.ACCOUNT_TYPES.get(CleanText('.')(title), Account.TYPE_UNKNOWN)
                for tr in table.xpath('./table/tbody/tr[contains(@id,"MM_SYNTHESE_CREDITS") and contains(@id,"IdTrGlobal")]'):
                    tds = tr.findall('td')
                    if len(tds) == 0 :
                        continue
                    for i in tds[0].xpath('.//a/strong'):
                        label = i.text.strip()
                        break
                    if len(tds) == 3 and Decimal(FrenchTransaction.clean_amount(CleanText('.')(tds[-2]))) and any(cls in Attr('.', 'id')(tr) for cls in ['dgImmo', 'dgConso']) == False:
                        # in case of Consumer credit or revolving credit, we substract avalaible amount with max amout
                        # to get what was spend
                        balance = Decimal(FrenchTransaction.clean_amount(CleanText('.')(tds[-2]))) - Decimal(FrenchTransaction.clean_amount(CleanText('.')(tds[-1])))
                    else:
                        balance = Decimal(FrenchTransaction.clean_amount(CleanText('.')(tds[-1])))
                    account = Loan()
                    account.id = label.split(' ')[-1]
                    account.label = unicode(label)
                    account.type = account_type
                    account.balance = -abs(balance)
                    account.currency = account.get_currency(CleanText('.')(tds[-1]))
                    account._card_links = []
                    if "immobiliers" in CleanText('.')(title):
                        xp = './/div[contains(@id, "IdDivDetail")]/table/tbody/tr[contains(@id, "%s")]/td'
                        account.maturity_date = Date(CleanText(xp % 'IdDerniereEcheance'), dayfirst=True, default=NotAvailable)(tr)
                        account.total_amount = CleanDecimal(CleanText(xp % 'IdCapitalEmprunte'), replace_dots=True, default=NotAvailable)(tr)
                        account.subscription_date = Date(CleanText(xp % 'IdDateOuverture'), dayfirst=True, default=NotAvailable)(tr)
                        account.next_payment_date = Date(CleanText(xp % 'IdDateProchaineEcheance'), dayfirst=True, default=NotAvailable)(tr)
                        account.rate = CleanDecimal(CleanText(xp % 'IdTaux'), replace_dots=True, default=NotAvailable)(tr)
                        account.next_payment_amount = CleanDecimal(CleanText(xp % 'IdMontantEcheance'), replace_dots=True, default=NotAvailable)(tr)
                    elif "renouvelables" in CleanText('.')(title):
                        self.go_loans_conso(tr)
                        d = self.browser.loans_conso()
                        if d:
                            account.total_amount = d['contrat']['creditMaxAutorise']
                            account.available_amount = d['situationCredit']['disponible']
                            account.next_payment_amount = d['situationCredit']['mensualiteEnCours']
                    accounts[account.id] = account
        return accounts.values()
开发者ID:P4ncake,项目名称:weboob,代码行数:61,代码来源:pages.py

示例8: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        for table in self.document.getroot().cssselect('div#table-panorama table.table-produit'):
            tds = table.xpath('./tbody/tr')[0].findall('td')
            if len(tds) < 3:
                continue

            boxes = table.xpath('./tbody//tr')
            foot = table.xpath('./tfoot//tr')

            for box in boxes:
                account = Account()

                if len(box.xpath('.//a')) != 0 and 'onclick' in box.xpath('.//a')[0].attrib:
                    args = self.js2args(box.xpath('.//a')[0].attrib['onclick'])
                    account.label =  u'{0} {1}'.format(unicode(table.xpath('./caption')[0].text.strip()), unicode(box.xpath('.//a')[0].text.strip()))
                elif len(foot[0].xpath('.//a')) != 0 and 'onclick' in foot[0].xpath('.//a')[0].attrib:
                    args = self.js2args(foot[0].xpath('.//a')[0].attrib['onclick'])
                    account.label =  unicode(table.xpath('./caption')[0].text.strip())
                else:
                    continue

                self.logger.debug('Args: %r' % args)
                if 'paramNumCompte' not in args:
                    try:
                        label = unicode(table.xpath('./caption')[0].text.strip())
                    except Exception:
                        label = 'Unable to determine'
                    self.logger.warning('Unable to get account ID for %r' % label)
                    continue
                try:
                    account.id = args['paramNumCompte'] + args['paramNumContrat']
                    if 'Visa' in account.label:
                        card_id = re.search('(\d+)', box.xpath('./td[2]')[0].text.strip())
                        if card_id:
                            account.id += card_id.group(1)
                    if 'Valorisation' in account.label or u'Liquidités' in account.label:
                        account.id += args['idPanorama:_idcl'].split('Jsp')[-1]

                except KeyError:
                    account.id = args['paramNumCompte']
                account_type_str = table.attrib['class'].split(' ')[-1][len('tableaux-comptes-'):]
                account.type = self.ACCOUNT_TYPES.get(account_type_str, Account.TYPE_UNKNOWN)

                currency_title = table.xpath('./thead//th[@class="montant"]')[0].text.strip()
                m = re.match('Montant \((\w+)\)', currency_title)
                if not m:
                    self.logger.warning('Unable to parse currency %r' % currency_title)
                else:
                    account.currency = account.get_currency(m.group(1))

                try:
                    account.balance = Decimal(FrenchTransaction.clean_amount(self.parse_number(u''.join([txt.strip() for txt in box.cssselect("td.montant")[0].itertext()]))))
                except InvalidOperation:
                    #The account doesn't have a amount
                    pass
                account._args = args
                yield account
开发者ID:ffourcot,项目名称:weboob,代码行数:59,代码来源:pages.py

示例9: get_accounts

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_accounts(self):
        accounts = {}
        content = self.document.xpath('//div[@id="main"]//div[@class="col first"]')[0]

        # Total currency balance.
        # If there are multiple currencies, this balance is all currencies
        # converted to the main currency.
        balance = content.xpath('.//h3/span[@class="balance"]')
        if not balance:
            balance = content.xpath('.//li[@class="balance"]//span/strong')
        balance = balance[0].text_content().strip()

        # Primary currency account
        primary_account = Account()
        primary_account.type = Account.TYPE_CHECKING
        primary_account.balance = clean_amount(balance)
        primary_account.currency = Account.get_currency(balance)
        primary_account.id = unicode(primary_account.currency)
        primary_account.label = u'%s %s*' % (self.browser.username, balance.split()[-1])
        accounts[primary_account.id] = primary_account

        # The following code will only work if the user enabled multiple currencies.
        balance = content.xpath('.//div[@class="body"]//ul/li[@class="balance"]/span')
        table = content.xpath('.//table[@id="balanceDetails"]//tbody//tr')

        # sanity check
        if bool(balance) is not bool(table):
            raise BrokenPageError('Unable to find all required multiple currency entries')

        # Primary currency balance.
        # If the user enabled multiple currencies, we get this one instead.
        # An Account object has only one currency; secondary currencies should be other accounts.
        if balance:
            balance = balance[0].text_content().strip()
            primary_account.balance = clean_amount(balance)
            # The primary currency of the "head balance" is the same; ensure we got the right one
            assert primary_account.currency == primary_account.get_currency(balance)

        for row in table:
            balance = row.xpath('.//td')[-1].text_content().strip()
            account = Account()
            account.type = Account.TYPE_CHECKING
            # XXX it ignores 5+ devises, so it's bad, but it prevents a crash, cf #1216
            try:
                account.balance = clean_amount(balance)
            except InvalidOperation:
                continue
            account.currency = Account.get_currency(balance)
            account.id = unicode(account.currency)
            account.label = u'%s %s' % (self.browser.username, balance.split()[-1])
            if account.id == primary_account.id:
                assert account.balance == primary_account.balance
                assert account.currency == primary_account.currency
            elif account.currency:
                accounts[account.id] = account

        return accounts
开发者ID:juliaL03,项目名称:weboob,代码行数:59,代码来源:pages.py

示例10: iter_accounts

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def iter_accounts(self, accnum, current_univers):
        seen = set()

        accounts_list = []

        for content in  self.get_content():
            if accnum != '00000000000' and content['numero'] != accnum:
                continue
            for poste in content['postes']:
                a = Account()
                a._number = content['numeroLong']
                a._nature = poste['codeNature']
                a._codeSousPoste = poste['codeSousPoste'] if 'codeSousPoste' in poste else None
                a._consultable = poste['consultable']
                a._univers = current_univers
                a.id = '%s.%s' % (a._number, a._nature)

                if a.id in seen:
                    # some accounts like "compte à terme fidélis" have the same _number and _nature
                    # but in fact are kind of closed, so worthless...
                    self.logger.warning('ignored account id %r (%r) because it is already used', a.id, poste.get('numeroDossier'))
                    continue

                seen.add(a.id)

                a.type = self.ACCOUNT_TYPES.get(poste['codeNature'], Account.TYPE_UNKNOWN)
                if a.type == Account.TYPE_UNKNOWN:
                    self.logger.warning("unknown type %s" % poste['codeNature'])

                if a.type == Account.TYPE_CARD:
                    a.parent = find_object(accounts_list, _number=a._number, type=Account.TYPE_CHECKING)

                if 'numeroDossier' in poste and poste['numeroDossier']:
                    a._file_number = poste['numeroDossier']
                    a.id += '.%s' % a._file_number

                if poste['postePortefeuille']:
                    a.label = u'Portefeuille Titres'
                    a.balance = Decimal(str(poste['montantTitres']['valeur']))
                    a.currency = poste['montantTitres']['monnaie']['code'].strip()
                    if not a.balance and not a.currency and 'dateTitres' not in poste:
                        continue
                    accounts_list.append(a)

                if 'libelle' not in poste:
                    continue

                a.label = ' '.join([content['intitule'].strip(), poste['libelle'].strip()])
                a.balance = Decimal(str(poste['solde']['valeur']))
                a.currency = poste['solde']['monnaie']['code'].strip()
                # Some accounts may have balance currency
                if 'Solde en devises' in a.label and a.currency != u'EUR':
                    a.id += str(poste['monnaie']['codeSwift'])
                accounts_list.append(a)

        return accounts_list
开发者ID:laurentb,项目名称:weboob,代码行数:58,代码来源:pages.py

示例11: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        account_type = Account.TYPE_UNKNOWN
        accounts = []

        for tr in self.doc.xpath('//div[@class="finance"]/form/table[@class="ecli"]/tr'):
            if tr.attrib.get('class', '') == 'entete':
                account_type = self.ACCOUNT_TYPES.get(tr.find('th').text.strip(), Account.TYPE_UNKNOWN)
                continue

            tds = tr.findall('td')
            a = tds[0].find('a')

            # Skip accounts that can't be accessed
            if a is None:
                continue

            balance = tds[-1].text.strip()

            account = Account()
            account.label = u' '.join([txt.strip() for txt in tds[0].itertext()])
            account.label = re.sub(u'[ \xa0\u2022\r\n\t]+', u' ', account.label).strip()

            # take "N° (FOO123 456)" but "N° (FOO123) MR. BAR"
            account.id = re.search(r'N° (\w+( \d+)*)', account.label).group(1).replace(' ', '')
            account.type = account_type

            for patt, type in self.ACCOUNT_TYPES2.items():
                if patt in account.label.lower():
                    account.type = type
                    break

            if balance:
                account.balance = Decimal(FrenchTransaction.clean_amount(balance))
                account.currency = account.get_currency(balance)

            if 'onclick' in a.attrib:
                m = re.search(r"javascript:submitForm\(([\w_]+),'([^']+)'\);", a.attrib['onclick'])
                if not m:
                    self.logger.warning('Unable to find link for %r' % account.label)
                    account._link = None
                else:
                    account._link = m.group(2)
            else:
                account._link = a.attrib['href'].strip()

            if accounts and accounts[-1].label == account.label and account.type == Account.TYPE_PEA:
                self.logger.warning('%s seems to be a duplicate of %s, skipping', account, accounts[-1])
                continue

            accounts.append(account)
        return accounts
开发者ID:P4ncake,项目名称:weboob,代码行数:53,代码来源:pages.py

示例12: get_accounts_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_accounts_list(self):
        data = {'clang': self.LANG,
                'ctcc': self.CTCC,
                'login': self.username,
                'session': self.sessionId}

        for dispositif in self.accountsp.open(data=data).get_list():
            if dispositif['montantBrutDispositif'] == 0:
                continue

            a = Account()
            a.id = dispositif['codeDispositif']
            a.type = Account.TYPE_MARKET
            a.balance = Decimal(dispositif["montantBrutDispositif"]).quantize(Decimal('.01'))
            a.label = dispositif['titreDispositif']
            a.currency = u"EUR"  # Don't find any possbility to get that from configuration.
            a._investments = []
            for fund in dispositif['listeFonds']:
                if fund['montantValeurEuro'] == 0:
                    continue

                i = Investment()
                i.id = i.code = dispositif['codeEntreprise'] + dispositif["codeDispositif"] + fund["codeSupport"]
                i.label = fund['libelleSupport']
                i.unitvalue = Decimal(fund["montantValeur"]).quantize(Decimal('.01'))
                i.valuation = Decimal(fund["montantValeurEuro"]).quantize(Decimal('.01'))
                i.quantity = i.valuation / i.unitvalue
                i.vdate = parse_date(fund['dateValeur'], dayfirst=True)
                a._investments.append(i)
            yield a
开发者ID:ffourcot,项目名称:weboob,代码行数:32,代码来源:browser.py

示例13: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        div = self.document.xpath('//div[@id="descriptifdroite"]')[0]

        account = Account()

        account.id = re.search(u'(\d+)', div.xpath('.//div[@class="credithauttexte"]')[0].text).group(1)
        account.label = u'Carte PASS'
        account.balance = Decimal('0')

        for tr in div.xpath('.//table/tr'):
            tds = tr.findall('td')

            if len(tds) < 3:
                continue

            label = u''.join([txt.strip() for txt in tds[1].itertext()])
            value = u''.join([txt.strip() for txt in tds[2].itertext()])

            if 'encours depuis le dernier' in label.lower():
                coming = u'-' + value
                account.coming = Decimal(FrenchTransaction.clean_amount(coming))
                account.currency = account.get_currency(coming)
            elif u'arrêté de compte' in label.lower():
                m = re.search(u'(\d+)/(\d+)/(\d+)', label)
                if m:
                    account._outstanding_date = datetime.date(*reversed(map(int, m.groups())))
                    break

        yield account
开发者ID:blckshrk,项目名称:Weboob,代码行数:31,代码来源:pages.py

示例14: populate

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
 def populate(self, accounts):
     cards = []
     for account in accounts:
         for li in  self.doc.xpath('//li[@class="nav-category"]'):
             title = CleanText().filter(li.xpath('./h3'))
             for a in li.xpath('./ul/li//a'):
                 label = CleanText().filter(a.xpath('.//span[@class="nav-category__name"]'))
                 balance_el = a.xpath('.//span[@class="nav-category__value"]')
                 balance = CleanDecimal(replace_dots=True, default=NotAvailable).filter(balance_el)
                 if 'CARTE' in label and balance:
                     acc = Account()
                     acc.balance = balance
                     acc.label = label
                     acc.currency = FrenchTransaction.Currency().filter(balance_el)
                     acc._link = Link().filter(a.xpath('.'))
                     acc._history_page = acc._link
                     acc.id = acc._webid = Regexp(pattern='([^=]+)$').filter(Link().filter(a.xpath('.')))
                     acc.type = Account.TYPE_CARD
                     if not acc in cards:
                         cards.append(acc)
                 elif account.label == label and account.balance == balance:
                     if not account.type:
                         account.type = AccountsPage.ACCOUNT_TYPES.get(title, Account.TYPE_UNKNOWN)
                     if account.type == Account.TYPE_LOAN:
                         account._history_page = None
                     elif account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_MARKET):
                         account._history_page = re.sub('/$', '', Link().filter(a.xpath('.')))
                     elif '/compte/cav' in a.attrib['href'] or not 'titulaire' in self.url:
                         account._history_page = self.browser.other_transactions
                     else:
                         account._history_page = self.browser.budget_transactions
                     account._webid = Attr(None, 'data-account-label').filter(a.xpath('.//span[@class="nav-category__name"]'))
     accounts.extend(cards)
开发者ID:dasimon,项目名称:weboob,代码行数:35,代码来源:pages.py

示例15: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import label [as 别名]
    def get_list(self):
        for tr in self.document.xpath('//table[@class="ca-table"]/tr'):
            if not tr.attrib.get('class', '').startswith('colcelligne'):
                continue

            cols = tr.findall('td')
            if not cols:
                continue

            account = Account()
            account.id = self.parser.tocleanstring(cols[self.COL_ID])
            account.label = self.parser.tocleanstring(cols[self.COL_LABEL])
            account.type = self.TYPES.get(account.label, Account.TYPE_UNKNOWN)
            balance = self.parser.tocleanstring(cols[self.COL_VALUE])
            # we have to ignore those accounts, because using NotAvailable
            # makes boobank and probably many others crash
            if balance in ('indisponible', ''):
                continue
            account.balance = Decimal(Transaction.clean_amount(balance))
            account.currency = account.get_currency(self.parser.tocleanstring(cols[self.COL_CURRENCY]))
            account._link = None

            a = cols[0].find('a')
            if a is not None:
                account._link = a.attrib['href'].replace(' ', '%20')

            yield account
开发者ID:Konubinix,项目名称:weboob,代码行数:29,代码来源:pages.py


注:本文中的weboob.capabilities.bank.Account.label方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。