weboob.browser.filters.base

exception weboob.browser.filters.base.FilterError

Bases: weboob.exceptions.ParseError

class weboob.browser.filters.base.Filter(selector=None, default=NO_DEFAULT)

Bases: weboob.browser.filters.base._Filter

Class used to filter on a HTML element given as call parameter to return matching elements.

Filters can be chained, so the parameter supplied to constructor can be either a xpath selector string, or an other filter called before.

>>> from lxml.html import etree
>>> f = CleanDecimal(CleanText('//p'), replace_dots=True)
>>> f(etree.fromstring('<html><body><p>blah: <span>229,90</span></p></body></html>'))
Decimal('229.90')
Parameters:default – default value in case the filter fails to find or parse the requested value
filter(value)

This method has to be overridden by children classes.

select(selector, item)