feat: Add send_request_enqueue_strategy option to BasicCrawler#1865
Open
feat: Add send_request_enqueue_strategy option to BasicCrawler#1865
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1865 +/- ##
==========================================
+ Coverage 92.44% 92.48% +0.04%
==========================================
Files 158 158
Lines 11026 11033 +7
==========================================
+ Hits 10193 10204 +11
+ Misses 833 829 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
075a54a to
96b840f
Compare
96b840f to
fa5f402
Compare
Member
|
Isn't this weird? If the URL is explicitly provided, we should just follow it. If the URL was added to the queue, it must have already respected the enqueue links strategy, or again, be explicitly provided. |
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.
Summary
Adds an opt-in
send_request_enqueue_strategy: EnqueueStrategy = 'all'option toBasicCrawlerso handlers can reject cross-hostsend_requestcalls. Default'all'preserves current behavior.Follow-up to #1864, which applied the same
EnqueueStrategymechanism toSitemapRequestLoader.What changed
send_request_enqueue_strategyoption onBasicCrawler/_BasicCrawlerOptions.'all',_prepare_send_request_functionvalidates the target URL against the current request'sloaded_url(falling back tourl) via_check_enqueue_strategyand raisesValueErroron mismatch.Request, so post-redirectloaded_urlis the origin once set.