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

Method _create_new_session

src/crawlee/sessions/_session_pool.py:229–236  ·  view source on GitHub ↗

Create a new session, add it to the pool and return it.

(self)

Source from the content-addressed store, hash-verified

227 await self._state.reset()
228
229 async def _create_new_session(self) -> Session:
230 """Create a new session, add it to the pool and return it."""
231 if self._create_session_function:
232 new_session = self._create_session_function()
233 else:
234 new_session = Session(**self._session_settings)
235 self._state.current_value.sessions[new_session.id] = new_session
236 return new_session
237
238 async def _fill_sessions_to_max(self) -> None:
239 """Fill the pool with sessions to the maximum size."""

Callers 2

get_sessionMethod · 0.95
_fill_sessions_to_maxMethod · 0.95

Calls 1

SessionClass · 0.90

Tested by

no test coverage detected