本文整理汇总了Python中weboob.capabilities.bank.Account._cmbvaleur2方法的典型用法代码示例。如果您正苦于以下问题:Python Account._cmbvaleur2方法的具体用法?Python Account._cmbvaleur2怎么用?Python Account._cmbvaleur2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Account
的用法示例。
在下文中一共展示了Account._cmbvaleur2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iter_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _cmbvaleur2 [as 别名]
def iter_accounts(self):
if not self.islogged:
self.login()
data = self.browser.open("https://www.cmb.fr/domiweb/prive/particulier/releve/0-releve.act").content
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
table = tree.xpath('/html/body/table')
if len(table) == 0:
title = tree.xpath('/html/head/title')[0].text
if title == u"Utilisateur non identifié":
self.login()
data = self.browser.open("https://www.cmb.fr/domiweb/prive/particulier/releve/0-releve.act").content
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
table = tree.xpath('/html/body/table')
if len(table) == 0:
raise ParseError()
else:
raise ParseError()
for tr in tree.xpath('/html/body//table[contains(@class, "Tb")]/tr'):
if tr.get('class', None) not in ('LnTit', 'LnTot', 'LnMnTiers', None):
account = Account()
td = tr.xpath('td')
a = td[1].xpath('a')
account.label = unicode(a[0].text).strip()
href = a[0].get('href')
m = match(r"javascript:releve\((.*),'(.*)','(.*)'\)",
href)
if not m:
continue
account.id = unicode(m.group(1) + m.group(2) + m.group(3))
account._cmbvaleur = m.group(1)
account._cmbvaleur2 = m.group(2)
account._cmbtype = m.group(3)
balance = u''.join([txt.strip() for txt in td[2].itertext()])
balance = balance.replace(',', '.').replace(u"\xa0", '')
account.balance = Decimal(balance)
span = td[4].xpath('a/span')
if len(span):
coming = span[0].text.replace(' ', '').replace(',', '.')
coming = coming.replace(u"\xa0", '')
account.coming = Decimal(coming)
else:
account.coming = NotAvailable
yield account
示例2: iter_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _cmbvaleur2 [as 别名]
def iter_accounts(self):
if not self.cookie:
self.login()
def do_http():
if 'no_check' in self.config and self.config['no_check'].get() == "y":
conn = HellHTTPS("www.cmb.fr")
else:
conn = HellHTTPS("www.cmb.fr", ca_file=self.AUTH_CERT, callBack=self.sslCallBack)
conn.connect()
headers = self.headers
headers['Cookie'] = self.cookie
conn.request("GET",
'/domiweb/prive/particulier/releve/0-releve.act',
{},
headers)
response = conn.getresponse()
data = response.read()
conn.close()
return data
data = do_http()
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
table = tree.xpath('/html/body/table')
if len(table) == 0:
title = tree.xpath('/html/head/title')[0].text
if title == u"Utilisateur non identifié":
self.login()
data = do_http()
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
table = tree.xpath('/html/body/table')
if len(table) == 0:
raise BrokenPageError()
else:
raise BrokenPageError()
for tr in tree.xpath('/html/body//table[contains(@class, "Tb")]/tr'):
if tr.get('class', None) not in ('LnTit', 'LnTot', 'LnMnTiers', None):
account = Account()
td = tr.xpath('td')
a = td[1].xpath('a')
account.label = unicode(a[0].text).strip()
href = a[0].get('href')
m = match(r"javascript:releve\((.*),'(.*)','(.*)'\)",
href)
if not m:
continue
account.id = unicode(m.group(1) + m.group(2) + m.group(3))
account._cmbvaleur = m.group(1)
account._cmbvaleur2 = m.group(2)
account._cmbtype = m.group(3)
balance = u''.join([txt.strip() for txt in td[2].itertext()])
balance = balance.replace(',', '.').replace(u"\xa0", '')
account.balance = Decimal(balance)
span = td[4].xpath('a/span')
if len(span):
coming = span[0].text.replace(' ', '').replace(',', '.')
coming = coming.replace(u"\xa0", '')
account.coming = Decimal(coming)
else:
account.coming = NotAvailable
yield account