woob.browser.elements

exception DataError[source]

Bases: Exception

Returned data from pages are incoherent.

class AbstractElement(*args, **kwargs)[source]

Bases: object

condition = None

The condition to parse the element.

This allows ignoring certain elements if certain fields are not valid, or if the element should actually be parsed using another class.

This property can be defined as:

  • None or True, to signify that the element should be parsed regardless.

  • False, to signify that the element should not be parsed regardless.

  • A filter returning a falsy or non-falsy object, evaluated with the constructed document section (HTML element or JSON data) for the element.

  • A method returning a falsy or non-falsy object, evaluated with the element object directly.

use_selector(func, key=None)[source]
parse(obj)[source]
cssselect(*args, **kwargs)[source]
xpath(*args, **kwargs)[source]
handle_loaders()[source]
fill_env(page, parent=None)[source]
check_condition()[source]

Get whether our condition is respected or not.

class ListElement(*args, **kwargs)[source]

Bases: AbstractElement

item_xpath = None
empty_xpath = None
flush_at_end = False
ignore_duplicate = False
find_elements()[source]

Get the nodes that will have to be processed. This method can be overridden if xpath filters are not sufficient.

flush()[source]
check_next_page()[source]
store(obj)[source]
class ItemElement(*args, **kwargs)[source]

Bases: AbstractElement

klass = None
validate = None
skip_optional_fields_errors = False
class Index[source]

Bases: object

build_object()[source]
should_highlight()[source]
handle_attr(key, func)[source]
class TableElement(*args, **kwargs)[source]

Bases: ListElement

head_xpath = None
cleaner

alias of CleanText

get_colnum(name)[source]
exception SkipItem[source]

Bases: Exception

Raise this exception in an ItemElement subclass to skip an item.

class ItemElementFromAbstractPage[source]

Bases: object

Don’t use this class, import woob_modules.other_module.etc instead