MCPcopy Create free account
hub / github.com/apify/crawlee-python / request_handler

Function request_handler

docs/introduction/code_examples/03_globs.py:11–23  ·  view source on GitHub ↗
(context: BeautifulSoupCrawlingContext)

Source from the content-addressed store, hash-verified

9
10 @crawler.router.default_handler
11 async def request_handler(context: BeautifulSoupCrawlingContext) -> None:
12 context.log.info(f'Processing {context.request.url}.')
13
14 # Enqueue links that match the 'include' glob pattern and
15 # do not match the 'exclude' glob pattern.
16 # highlight-next-line
17 await context.enqueue_links(
18 # highlight-next-line
19 include=[Glob('https://someplace.com/**/cats')],
20 # highlight-next-line
21 exclude=[Glob('https://**/archive/**')],
22 # highlight-next-line
23 )
24
25 await crawler.run(['https://crawlee.dev/'])
26

Callers

nothing calls this directly

Calls 2

GlobClass · 0.90
enqueue_linksMethod · 0.80

Tested by

no test coverage detected