Repository navigation
feat(crawlers)!: Remove use_session_pool and always use sessions - #2439
Merged
Merged
Conversation
use_session_pool and always process requests with a sessionuse_session_pool and always use sessions
vdusek
reviewed
Nov 16, 2026
…rror` BREAKING CHANGE: The `RequestCollisionError` message for a request whose bound session is no longer usable changed from "... is no longer available in SessionPool" to "... is no longer usable".
This was
linked to
issues
Nov 17, 2026
vdusek
pushed a commit
that referenced
this pull request
Nov 18, 2026
### Description - A crawler now enters and exits only the objects it creates. A session pool, browser pool, HTTP client, rendering type predictor or PydanticAI extractor passed to it is the caller's to enter before `run()`, and `run()` raises otherwise. The crawler no longer closes it after a run or resets it on the next one. `Statistics` stay the exception: the crawler enters them on every run, so crawlers can share an instance one after another, but not at the same time. - `PydanticAiDirectExtractor` becomes an async context manager, and session pools, statistics, HTTP clients and the default rendering type predictor can be entered again after a failed or cancelled entry or exit. For details, see "Crawlers manage only what they create" in the upgrade guide. The docs examples and project templates follow in a separate PR. ### Issues - Part of: #2301 - Follow-up: #2439 ### Testing - New unit and integration tests for passed and own objects of every crawler, and for failed or cancelled entries and exits. *✍️ Drafted by Claude Code*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
use_session_pooloption is removed. Every crawler now processes each request with a session from itsSessionPool, socontext.sessionis always aSessionand handlers no longer needif context.sessionchecks. A request bound bysession_idto a session that's no longer usable still fails withRequestCollisionError. Its failed request handler gets that session while the pool still holds it, otherwise a retired session with the bound id.For crawlers that ran without the pool, 401, 403 and 429 responses now rotate the session, and with
proxy_urlsa session keeps its proxy.Issues
blocked_status_codesfromSessionto the crawler #2139, Store the proxy inSessionand drop session and request arguments fromProxyConfiguration#2298Testing
✍️ Drafted by Claude Code