本文整理汇总了Python中weboob.tools.capabilities.bank.transactions.FrenchTransaction._currency方法的典型用法代码示例。如果您正苦于以下问题:Python FrenchTransaction._currency方法的具体用法?Python FrenchTransaction._currency怎么用?Python FrenchTransaction._currency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.tools.capabilities.bank.transactions.FrenchTransaction
的用法示例。
在下文中一共展示了FrenchTransaction._currency方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import _currency [as 别名]
def parse_transaction(self, transaction, account):
t = FrenchTransaction(transaction['activityId'])
date = parse_french_date(transaction['date'])
raw = transaction.get('counterparty', transaction['displayType'])
t.parse(date=date, raw=raw)
try:
if transaction['currencyCode'] != account.currency:
transaction = self.browser.convert_amount(account, transaction)
t.original_amount = self.format_amount(transaction['originalAmount'], transaction["isCredit"])
t.original_currency = u'' + transaction["currencyCode"]
t.amount = self.format_amount(transaction['netAmount'], transaction["isCredit"])
except KeyError:
return
t._currency = transaction['currencyCode']
return t
示例2: parse_transaction
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import _currency [as 别名]
def parse_transaction(self, transaction):
t = FrenchTransaction(transaction['activityId'])
date = parse_french_date(transaction['date'])
try:
raw = transaction['counterparty']
except KeyError:
raw = transaction['displayType']
t.parse(date=date, raw=raw)
try:
amount = transaction['netAmount']
except KeyError:
return
if transaction['isCredit']:
t.set_amount(credit=amount)
else:
t.set_amount(debit=amount)
t._currency = transaction['currencyCode']
return t
示例3: parse
# 需要导入模块: from weboob.tools.capabilities.bank.transactions import FrenchTransaction [as 别名]
# 或者: from weboob.tools.capabilities.bank.transactions.FrenchTransaction import _currency [as 别名]
def parse(self):
for tr in self.document.xpath('//tbody/tr'):
tlink = tr.xpath('./td[@class="desc"]/a[@class="rowClick"]')[0].attrib['href'].strip()
t = FrenchTransaction(tlink[tlink.find('&id=')+4:])
date = parse_french_date(tr.xpath('./td[@class="date"]')[0].text.strip())
raw = tr.xpath('./td[@class="desc"]/a[@class="rowClick"]')[0].tail.strip()
# Filter lines that do not actually modify the balance
if raw.startswith('Autorisation ') or raw.endswith(' en attente par PayPal'):
continue
t.parse(date=date, raw=raw)
amount = tr.xpath('./td[@class="price-value net"]')[0].text.strip()
t.set_amount(amount)
commission = tr.xpath('./td[@class="price-value fee"]')[0].text.strip()
t.commission = Decimal(t.clean_amount(commission))
t.label = t.raw
if t.commission:
t.label += " (%s)" % tr.xpath('./td[@class="price-value gross"]')[0].text.strip()
t._currency = Account.get_currency(amount)
yield t