Converters

A module with common attrs converters

class zyte_common_items.converters.MetadataCaster(target)

attrs converter that converts an input metadata object into the metadata class declared by the container page object class.

zyte_common_items.converters.to_probability_request_list(request_list)

attrs converter to turn lists of Request instances into lists of ProbabilityRequest instances.

zyte_common_items.converters.to_probability_request_list_optional(request_list)

attrs converter to turn lists of Request instances into lists of ProbabilityRequest instances. If None is passed, None is returned.

zyte_common_items.converters.url_to_str(url: str | RequestUrl | ResponseUrl) str

Return the input RequestUrl or ResponseUrl object as a string.

zyte_common_items.converters.url_to_str_optional(url: str | RequestUrl | ResponseUrl | None) str | None

Return the input RequestUrl or ResponseUrl object as a string, or None if url is None.