Supporting rulesΒΆ

Ideally, a framework should support returning the right page object or output item given a target URL and a desired output item class when rules are used.

To provide basic support for rules in your framework, use the RulesRegistry object at web_poet.default_registry to choose a page object based on rules:

from web_poet import default_registry

page_cls = default_registry.page_cls_for_item("", MyItem)

You should also let your users know what is the best approach to load rules when using your framework. For example, let them know the best location for their calls to the consume_modules() function.