本文整理汇总了Python中weboob.capabilities.bank.Investment.description方法的典型用法代码示例。如果您正苦于以下问题:Python Investment.description方法的具体用法?Python Investment.description怎么用?Python Investment.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Investment
的用法示例。
在下文中一共展示了Investment.description方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iter_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import description [as 别名]
def iter_investment(self):
rows = self.document.xpath('//table[@id="mefav_repartition_supports_BPF"]//tr') or \
self.document.xpath('//tbody[@id="mefav_repartition_supports"]//tr')
for tr in rows:
cells = clean_cells(tr.findall('td'))
cells[3:] = clean_amounts(cells[3:])
inv = Investment()
inv.label, _, inv.code, inv.quantity, inv.unitvalue, inv.valuation, _ = cells
if inv.code:
inv.id = inv.code
if not inv.unitvalue:
# XXX Fonds eu Euros
inv.code = u'XX' + re.sub(ur'[^A-Za-z0-9]', u'', inv.label).upper()
inv.description = u''
yield inv
示例2: iter_investments
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import description [as 别名]
def iter_investments(self):
# We did not get some html, but something like that (XX is a quantity, YY a price):
# message='[...]
# popup=2{6{E:ALO{PAR{{reel{695{380{ALSTOM REGROUPT#XX#YY,YY €#YY,YY €#1 YYY,YY €#-YYY,YY €#-42,42%#-0,98 %#42,42 %#|1|AXA#cotationValeur.php?val=E:CS&pl=6&nc=1&
# popup=2{6{E:CS{PAR{{reel{695{380{AXA#XX#YY,YY €#YY,YYY €#YYY,YY €#YY,YY €#3,70%#42,42 %#42,42 %#|1|blablablab #cotationValeur.php?val=P:CODE&pl=6&nc=1&
# [...]
lines = self.doc.split("popup=2")
lines.pop(0)
for line in lines:
columns = line.split('#')
_id = columns[0].split('{')[2]
invest = Investment(_id)
invest.label = unicode(columns[0].split('{')[-1])
invest.code = _id.split(':')[0]
if ':' in _id:
invest.description = unicode(_id.split(':')[1])
quantity = FrenchTransaction.clean_amount(columns[1])
if quantity != '':
invest.quantity = Decimal(quantity)
else:
invest.quantity = NotAvailable
unitprice = FrenchTransaction.clean_amount(columns[2])
if unitprice != '':
invest.unitprice = Decimal(unitprice)
else:
invest.unitprice = NotAvailable
unitvalue = FrenchTransaction.clean_amount(columns[3])
if unitvalue != '':
invest.unitvalue = Decimal(unitvalue)
else:
invest.unitvalue = NotAvailable
valuation = FrenchTransaction.clean_amount(columns[4])
if valuation != '':
invest.valuation = Decimal(valuation)
else:
invest.valuation = NotAvailable
diff = FrenchTransaction.clean_amount(columns[5])
if diff != '':
invest.diff = Decimal(diff)
else:
invest.diff = NotAvailable
yield invest