Skip to content

Pass router as request_handler to crawler - is this intended? #1600

@vdusek

Description

@vdusek

For example:

from crawlee.crawlers import PlaywrightCrawler
from crawlee.router import Router

router = Router[PlaywrightCrawlingContext]()

# ...

crawler = PlaywrightCrawler(
    request_handler=router,
)

Shouldn't the arg be named router?

We would also need to update its type and this part of the BasicCrawler's init:

# Request router setup
self._router: Router[TCrawlingContext] | None = None
if isinstance(cast('Router', request_handler), Router):
    self._router = cast('Router[TCrawlingContext]', request_handler)
elif request_handler is not None:
    self._router = None
    self.router.default_handler(request_handler)

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions