本文整理汇总了Python中weboob.capabilities.bank.Account._id方法的典型用法代码示例。如果您正苦于以下问题:Python Account._id方法的具体用法?Python Account._id怎么用?Python Account._id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Account
的用法示例。
在下文中一共展示了Account._id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _id [as 别名]
def get_list(self):
# TODO: no idea abount how proxy account are displayed
for a in self.document.xpath('//a[@class="mainclic"]'):
account = Account()
account.currency = Currency.CUR_EUR
account.id = unicode(a.find('span[@class="account-number"]').text)
account._id = account.id
account.label = unicode(a.find('span[@class="title"]').text)
balance = a.find('span[@class="solde"]/label').text
account.balance = Decimal(FrenchTransaction.clean_amount(balance))
account.coming = NotAvailable
if "Courant" in account.label:
account.id = "CC-" + account.id
account.type = Account.TYPE_CHECKING
elif "Livret A" in account.label:
account.id = "LA-" + account.id
account.type = Account.TYPE_SAVINGS
elif "Orange" in account.label:
account.id = "LEO-" + account.id
account.type = Account.TYPE_SAVINGS
elif "Durable" in account.label:
account.id = "LDD-" + account.id
account.type = Account.TYPE_SAVINGS
elif "Titres" in account.label:
account.id = "TITRE-" + account.id
account.type = Account.TYPE_MARKET
elif "PEA" in account.label:
account.id = "PEA-" + account.id
account.type = Account.TYPE_MARKET
jid = self.document.find('//input[@name="javax.faces.ViewState"]')
account._jid = jid.attrib['value']
yield account
示例2: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _id [as 别名]
def get_list(self):
TABLE_XPATH = '//table[caption[@class="caption tdb-cartes-caption" or @class="ca-table caption"]]'
cards_tables = self.document.xpath(TABLE_XPATH)
currency = self.document.xpath('//table/caption//span/text()[starts-with(.,"Montants en ")]')[0].replace("Montants en ", "") or None
if cards_tables:
self.logger.debug('There are several cards')
xpaths = {
'_id': './caption/span[@class="tdb-cartes-num"]',
'label1': './caption/span[contains(@class, "tdb-cartes-carte")]',
'label2': './caption/span[@class="tdb-cartes-prop"]',
'balance': './/tr/td[@class="cel-num"]',
'currency': '//table/caption//span/text()[starts-with(.,"Montants en ")]',
'link': './/tr//a/@href[contains(., "fwkaction=Detail")]',
}
else:
self.logger.debug('There is only one card')
xpaths = {
'_id': './/tr/td[@class="cel-texte"]',
'label1': './/tr[@class="ligne-impaire ligne-bleu"]/th',
'label2': './caption/span[@class="tdb-cartes-prop"]/b',
'balance': './/tr[last()-1]/td[@class="cel-num"] | .//tr[last()-2]/td[@class="cel-num"]',
'currency': '//table/caption//span/text()[starts-with(.,"Montants en ")]',
}
TABLE_XPATH = '(//table[@class="ca-table"])[1]'
cards_tables = self.document.xpath(TABLE_XPATH)
for table in cards_tables:
get = lambda name: self.parser.tocleanstring(table.xpath(xpaths[name])[0])
account = Account()
account.type = account.TYPE_CARD
account.id = ''.join(get('_id').split()[1:])
account._id = ' '.join(get('_id').split()[1:])
account.label = '%s - %s' % (get('label1'),
re.sub('\s*-\s*$', '', get('label2')))
try:
account.balance = Decimal(Transaction.clean_amount(table.xpath(xpaths['balance'])[-1].text))
account.currency = account.get_currency(self.document
.xpath(xpaths['currency'])[0].replace("Montants en ", ""))
if not account.currency and currency:
account.currency = Account.get_currency(currency)
except IndexError:
account.balance = Decimal('0.0')
if 'link' in xpaths:
try:
account._link = table.xpath(xpaths['link'])[-1]
except IndexError:
account._link = None
else:
account._link = re.sub('[\n\r\t]+', '', account._link)
else:
account._link = self.url
account._perimeter = self.browser.current_perimeter
yield account
示例3: iter_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import _id [as 别名]
def iter_accounts(self):
for classeur in self.doc.get('donnees', {}).get('classeurs', {}):
title = classeur['title']
for compte in classeur.get('comptes', []):
a = Account()
a.label = CleanText().filter(compte['libelle'])
a._id = compte['id']
a.type = self.obj_type(a.label)
a.number = compte['iban'].replace(' ', '')
# for some account that don't have Iban the account number is store under this variable in the Json
if not is_iban_valid(a.number):
a.iban = NotAvailable
else:
a.iban = a.number
# id based on iban to match ids in database.
a.id = a.number[4:-2] if len(a.number) == 27 else a.number
a._agency = compte['agenceGestionnaire']
a._title = title
yield a