woob.browser.filters.base

exception FilterError[source]

Bases: ParseError

exception ItemNotFound[source]

Bases: FilterError

class Filter(selector=None, default=_NO_DEFAULT)[source]

Bases: _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')
select(selector, item)[source]
filter(value)[source]

This method has to be overridden by children classes.