本文整理汇总了Python中weboob.capabilities.bank.Account.balance方法的典型用法代码示例。如果您正苦于以下问题:Python Account.balance方法的具体用法?Python Account.balance怎么用?Python Account.balance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Account
的用法示例。
在下文中一共展示了Account.balance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_accounts_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例2: get_accounts_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例3: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def get_list(self):
accounts = []
previous_account = None
noaccounts = self.get_from_js('_js_noMvts =', ';')
if noaccounts is not None:
assert 'avez aucun compte' in noaccounts
return []
txt = self.get_from_js('_data = new Array(', ');', is_list=True)
if txt is None:
raise BrowserUnavailable('Unable to find accounts list in scripts')
data = json.loads('[%s]' % txt.replace("'", '"'))
for line in data:
a = Account()
a.id = line[self.COL_ID].replace(' ', '')
if re.match(r'Classement=(.*?):::Banque=(.*?):::Agence=(.*?):::SScompte=(.*?):::Serie=(.*)', a.id):
a.id = str(CleanDecimal().filter(a.id))
a._acc_nb = a.id.split('_')[0] if len(a.id.split('_')) > 1 else None
a.label = MyStrip(line[self.COL_LABEL], xpath='.//div[@class="libelleCompteTDB"]')
# This account can be multiple life insurance accounts
if a.label == 'ASSURANCE VIE-BON CAPI-SCPI-DIVERS *':
continue
a.balance = Decimal(FrenchTransaction.clean_amount(line[self.COL_BALANCE]))
a.currency = a.get_currency(line[self.COL_BALANCE])
a.type = self.get_account_type(a.label)
# The parent account must be created right before
if a.type == Account.TYPE_CARD:
# duplicate
if find_object(accounts, id=a.id):
self.logger.warning('Ignoring duplicate card %r', a.id)
continue
a.parent = previous_account
if line[self.COL_HISTORY] == 'true':
a._inv = False
a._link = self.get_history_link()
a._args = self.make__args_dict(line)
else:
a._inv = True
a._args = {'_ipc_eventValue': line[self.COL_ID],
'_ipc_fireEvent': line[self.COL_FIRE_EVENT],
}
a._link = self.doc.xpath('//form[@name="changePageForm"]')[0].attrib['action']
if a.type is Account.TYPE_CARD:
a.coming = a.balance
a.balance = Decimal('0.0')
accounts.append(a)
previous_account = a
return accounts
示例4: get_accounts_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例5: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例6: get_loan_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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()
示例7: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例8: iter_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def iter_accounts(self, next_pages):
account_type = Account.TYPE_UNKNOWN
params = {}
for field in self.document.xpath('//input'):
params[field.attrib['name']] = field.attrib.get('value', '')
for div in self.document.getroot().cssselect('div.btit'):
if div.text is None:
continue
account_type = self.ACCOUNT_TYPES.get(div.text.strip(), Account.TYPE_UNKNOWN)
if account_type is None:
# ignore services accounts
continue
currency = None
for th in div.getnext().xpath('.//thead//th'):
m = re.match('.*\((\w+)\)$', th.text)
if m and currency is None:
currency = Account.get_currency(m.group(1))
for tr in div.getnext().xpath('.//tbody/tr'):
if 'id' not in tr.attrib:
continue
args = dict(parse_qsl(tr.attrib['id']))
tds = tr.findall('td')
if len(tds) < 4 or 'identifiant' not in args:
self.logger.warning('Unable to parse an account')
continue
account = Account()
account.id = args['identifiant'].replace(' ', '')
account.label = u' '.join([u''.join([txt.strip() for txt in tds[1].itertext()]),
u''.join([txt.strip() for txt in tds[2].itertext()])]).strip()
account.type = account_type
balance = FrenchTransaction.clean_amount(u''.join([txt.strip() for txt in tds[3].itertext()]))
account.balance = Decimal(balance or '0.0')
account.currency = currency
if account.type == account.TYPE_LOAN:
account.balance = - abs(account.balance)
account._prev_debit = None
account._next_debit = None
account._params = None
account._coming_params = None
if balance != u'' and len(tds[3].xpath('.//a')) > 0:
account._params = params.copy()
account._params['dialogActionPerformed'] = 'SOLDE'
account._params['attribute($SEL_$%s)' % tr.attrib['id'].split('_')[0]] = tr.attrib['id'].split('_', 1)[1]
if len(tds) >= 5 and len(tds[self.COL_COMING].xpath('.//a')) > 0:
_params = account._params.copy()
_params['dialogActionPerformed'] = 'ENCOURS_COMPTE'
next_pages.append(_params)
yield account
示例9: get_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例10: iter_accounts
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [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
示例11: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def get_list(self):
accounts = []
for tr in self.document.getiterator('tr'):
if not 'LGNTableRow' in tr.attrib.get('class', '').split():
continue
account = Account()
for td in tr.getiterator('td'):
if td.attrib.get('headers', '') == 'TypeCompte':
a = td.find('a')
if a is None:
break
account.label = unicode(a.find("span").text)
for pattern, actype in self.TYPES.iteritems():
if account.label.startswith(pattern):
account.type = actype
account._link_id = a.get('href', '')
elif td.attrib.get('headers', '') == 'NumeroCompte':
id = td.text
id = id.replace(u'\xa0','')
account.id = id
elif td.attrib.get('headers', '') == 'Libelle':
pass
elif td.attrib.get('headers', '') == 'Solde':
div = td.xpath('./div[@class="Solde"]')
if len(div) > 0:
balance = self.parser.tocleanstring(div[0])
if len(balance) > 0 and balance not in ('ANNULEE', 'OPPOSITION'):
try:
account.balance = Decimal(FrenchTransaction.clean_amount(balance))
except InvalidOperation:
raise BrokenPageError('Unable to parse balance %r' % balance)
account.currency = account.get_currency(balance)
else:
account.balance = NotAvailable
if not account.label or empty(account.balance):
continue
if 'CARTE_' in account._link_id:
ac = accounts[0]
ac._card_links.append(account._link_id)
if not ac.coming:
ac.coming = Decimal('0.0')
ac.coming += account.balance
else:
account._card_links = []
accounts.append(account)
return iter(accounts)
示例12: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def get_list(self):
for div in self.document.getiterator('div'):
if div.attrib.get('id', '') == 'synthese-list':
for tr in div.getiterator('tr'):
account = Account()
account.id = None
account._link_id = None
for td in tr.getiterator('td'):
if td.attrib.get('class', '') == 'account-cb':
break
elif td.attrib.get('class', '') == 'account-name':
try:
span = td.xpath('./span[@class="label"]')[0]
except IndexError:
# ignore account
break
account.label = self.parser.tocleanstring(span)
try:
account._link_id = td.xpath('.//a')[0].attrib['href']
except KeyError:
pass
elif td.attrib.get('class', '') == 'account-more-actions':
for a in td.getiterator('a'):
# For normal account, two "account-more-actions"
# One for the account, one for the credit card. Take the good one
if "mouvements.phtml" in a.attrib['href'] and "/cartes/" not in a.attrib['href']:
account._link_id = a.attrib['href']
elif td.attrib.get('class', '') == 'account-number':
id = td.text
id = id.strip(u' \n\t')
account.id = id
elif td.attrib.get('class', '') == 'account-total':
span = td.find('span')
if span is None:
balance = td.text
else:
balance = span.text
account.currency = account.get_currency(balance)
balance = FrenchTransaction.clean_amount(balance)
if balance != "":
account.balance = Decimal(balance)
else:
account.balance = Decimal(0)
else:
# because of some weird useless <tr>
if account.id is not None:
yield account
示例13: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def get_list(self):
for box in self.document.getroot().cssselect('div.roundedBox div.contentBox'):
a = Account()
a.id = self.parser.tocleanstring(box.xpath('.//tr[@id="summaryImageHeaderRow"]//div[@class="summaryTitles"]')[0])
a.label = self.parser.tocleanstring(box.xpath('.//span[@class="cardTitle"]')[0])
balance = self.parser.tocleanstring(self.parser.select(box, 'td#colOSBalance div.summaryValues', 1))
if balance in (u'Indisponible', u'Indisponible Facturation en cours', ''):
a.balance = NotAvailable
else:
a.balance = - abs(Decimal(Transaction.clean_amount(balance)))
a.currency = a.get_currency(balance)
a._link = self.parser.select(box, 'div.summaryTitles a.summaryLink', 1).attrib['href']
yield a
示例14: get_list
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def get_list(self):
for div in self.document.xpath('.//div[@id="card-details"]'):
a = Account()
a.id = self.parser.tocleanstring(div.xpath('.//span[@class="acc-num"]')[0])
a.label = self.parser.tocleanstring(div.xpath('.//span[@class="card-desc"]')[0])
balance = self.parser.tocleanstring(div.xpath('.//span[@class="balance-data"]')[0])
if balance in (u"Indisponible", u"Indisponible Facturation en cours", ""):
a.balance = NotAvailable
else:
a.balance = -abs(Decimal(Transaction.clean_amount(balance)))
a.currency = a.get_currency(balance)
a._link = self.document.xpath('.//div[@class="wide-bar"]/h3/a')[0].attrib["href"]
yield a
示例15: account
# 需要导入模块: from weboob.capabilities.bank import Account [as 别名]
# 或者: from weboob.capabilities.bank.Account import balance [as 别名]
def account(self):
label = u' '.join(self.doc.xpath(
'//div[contains(@class,"myCreditCardDetails")]')[0]\
.text_content().split())
balance = self.amount(u'Balance')
cardlimit = self.doc.xpath(
u'//li[text()="Available to Spend"]')[0].text_content()\
.replace(u'Available to Spend', u'').replace(u'Limit', u'').strip()
paymin = self.amount(u'Payment Due')
if self.doc.xpath(u'//li[@class="noPaymentDue"]'):
# If payment date is not scheduled yet, set it somewhere in a
# distant future, so that we always have a valid date.
paydate = datetime.now() + timedelta(days=999)
else:
rawtext = self.doc.xpath(
u'//li[contains(text(),"Due Date")]')[0].text_content()
datetext = re.match('.*(\d\d/\d\d/\d\d\d\d).*', rawtext).group(1)
paydate = datetime.strptime(datetext, '%m/%d/%Y')
a = Account()
a.id = label[-4:]
a.label = label
a.currency = Account.get_currency(balance)
a.balance = -AmTr.decimal_amount(balance)
a.type = Account.TYPE_CARD
a.cardlimit = AmTr.decimal_amount(cardlimit)
a.paymin = AmTr.decimal_amount(paymin)
if paydate is not None:
a.paydate = paydate
return a