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

Method __aexit__

src/crawlee/sessions/_session_pool.py:130–146  ·  view source on GitHub ↗

Deinitialize the pool upon exiting the context manager. Raises: RuntimeError: If the context manager is not active.

(
        self,
        exc_type: type[BaseException] | None,
        exc_value: BaseException | None,
        exc_traceback: TracebackType | None,
    )

Source from the content-addressed store, hash-verified

128 return self
129
130 async def __aexit__(
131 self,
132 exc_type: type[BaseException] | None,
133 exc_value: BaseException | None,
134 exc_traceback: TracebackType | None,
135 ) -> None:
136 """Deinitialize the pool upon exiting the context manager.
137
138 Raises:
139 RuntimeError: If the context manager is not active.
140 """
141 if not self._active:
142 raise RuntimeError(f'The {self.__class__.__name__} is not active.')
143
144 await self._state.teardown()
145
146 self._active = False
147
148 @overload
149 def get_state(self, *, as_dict: Literal[True]) -> dict: ...

Callers

nothing calls this directly

Calls 1

teardownMethod · 0.80

Tested by

no test coverage detected