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

Method close_with_hooks

src/crawlee/browsers/_browser_pool.py:405–410  ·  view source on GitHub ↗
(*args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

403 original_close = crawlee_page.page.close
404
405 async def close_with_hooks(*args: Any, **kwargs: Any) -> None:
406 try:
407 await self._execute_hooks(self._pre_page_close_hooks, crawlee_page, browser_controller)
408 finally:
409 await original_close(*args, **kwargs)
410 await self._execute_hooks(self._post_page_close_hooks, crawlee_page.id, browser_controller)
411
412 # `Page.close` is a regular method, so type checkers reject reassigning it directly.
413 # Install the hook-wrapped version through an untyped reference to the page.

Callers

nothing calls this directly

Calls 1

_execute_hooksMethod · 0.95

Tested by

no test coverage detected