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


Python Account._stp方法代码示例

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


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

示例1: _parse_account

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _stp [as 别名]
    def _parse_account(self, tr):
        account = Account()

        # for pro usage
        account._stp = None

        account.id = tr.xpath('.//td[@class="libelleCompte"]/input')[0].attrib['id'][len('libelleCompte'):]
        if len(str(account.id)) == 23:
            account.id = str(account.id)[5:21]

        a = tr.xpath('.//td[@class="libelleCompte"]/a')[0]
        m = re.match(r'javascript:goToStatements\(\'(\d+)\'', a.get('onclick', ''))
        if m:
            account._link_id = m.group(1)
        else:
            # Can't get history for this account.
            account._link_id = None
            # To prevent multiple-IDs for CIF (for example), add an arbitrary char in ID.
            account.id += 'C'

        account.label = u''+a.text.strip()

        tds = tr.findall('td')
        account.currency = account.get_currency(tds[3].find('a').text)
        account.balance = self._parse_amount(tds[3].find('a'))
        if tds[4].find('a') is not None:
            account.coming = self._parse_amount(tds[4].find('a'))
        else:
            account.coming = NotAvailable

        return account
开发者ID:juliaL03,项目名称:weboob,代码行数:33,代码来源:accounts_list.py

示例2: get_list

# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _stp [as 别名]
    def get_list(self, pro=True):
        accounts = []
        for tr in self.document.xpath('//tr[@class="comptes"]'):
            cols = tr.findall('td')

            if len(cols) < 5:
                continue

            account = Account()
            account.id = self.parser.tocleanstring(cols[self.COL_ID]).replace(" ", "")
            account.label = self.parser.tocleanstring(cols[self.COL_LABEL])
            account.balance = Decimal(self.parser.tocleanstring(cols[self.COL_BALANCE]))
            try:
                account.coming = Decimal(self.parser.tocleanstring(cols[self.COL_COMING]))
            except InvalidOperation:
                if self.parser.tocleanstring(cols[self.COL_COMING]) != '-':
                    self.logger.warning('Unable to parse coming value', exc_info=True)
                account.coming = NotAvailable
            account._link_id = None
            account._stp = None

            a = cols[self.COL_LABEL].find('a')
            if a is not None:
                url = urlparse(a.attrib['href'])
                p = dict(parse_qsl(url.query))
                account._link_id = p.get('ch4', None)
                account._stp = p.get('stp', None)

            for input_tag in tr.xpath('.//input[starts-with(@id, "urlRib")]'):
                m = re.search('ch4=(\w+)', input_tag.get('value', ''))
                if m:
                    account.iban = unicode(m.group(1))

            accounts.append(account)

        # If there are also personnal accounts linked, display the page and iter on them.
        if pro and len(self.document.xpath('//div[@class="onglets"]//a[contains(@href, "afficherComptesPrives")]')) > 0:
            self.browser.select_form(name='myForm')
            self.browser.set_all_readonly(False)
            self.browser['udcAction'] = '/afficherComptesPrives'
            self.browser.submit()

            for a in self.browser.page.get_list(False):
                accounts.append(a)

        return accounts
开发者ID:ngrislain,项目名称:weboob,代码行数:48,代码来源:pro.py


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