The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit cd996223 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[boursorama] Correct investment labels & codes

For the labels, we are fetching an <a> tag, except that some invests
have no link so we were retrieving invests with empty labels.
We now handle <a> or <strong> cases with a Coalesce.
Codes were handled with IsinCode & code_types with IsinType.
Used Base filter instead of ugly filter()(self)[0].xpath().
parent 4b9b938d
......@@ -853,17 +853,18 @@ class Myiter_investment(TableElement):
class Myitem(ItemElement):
klass = Investment
obj_label = Coalesce(
Base(TableCell('value'), CleanText('.//a')),
Base(TableCell('value'), CleanText('./strong')), # for investments without link
default=''
)
obj_quantity = CleanDecimal(TableCell('quantity'), default=NotAvailable)
obj_unitprice = CleanDecimal(TableCell('unitprice'), replace_dots=True, default=NotAvailable)
obj_unitvalue = CleanDecimal(TableCell('unitvalue'), replace_dots=True, default=NotAvailable)
obj_valuation = CleanDecimal(TableCell('valuation'), replace_dots=True, default=NotAvailable)
obj_diff = CleanDecimal(TableCell('diff'), replace_dots=True, default=NotAvailable)
def obj_label(self):
return CleanText().filter((TableCell('value')(self)[0]).xpath('.//a'))
def obj_code(self):
return CleanText().filter((TableCell('value')(self)[0]).xpath('./span')) or NotAvailable
obj_code = IsinCode(Base(TableCell('value'), CleanText('./span')), default=NotAvailable)
obj_code_type = IsinType(Base(TableCell('value'), CleanText('./span')))
def my_pagination(func):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment