-
Notifications
You must be signed in to change notification settings - Fork 48
fix deprecated calls to scrapy.utils.request.request_fingerprint
#50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
fix: update calls to removed function request_fingerprint
- Loading branch information
commit a9cd2dad048129f803ea47d005fdc15aa1c6a8fa
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Scrapy 2.7+, the right approach is using
Crawler.fingerprinter.fingerprint().There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Gallaecio wouldn't using this require storing an instance of (and instantiating) a
Crawlerobject as an instance variable?from the messages in scrapy 2.11.2 (https://github.com/scrapy/scrapy/blob/e8cb5a03b382b98f2c8945355076390f708b918d/scrapy/utils/request.py#L86-L136) it seems to suggest getting the crawler during instantiation with
DeltaFetch.from_crawlerif I am reading it right.but what if the
DeltaFetchobject isn't instantiated that way? what should happen inDeltaFetch._get_key?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeltaFetchis a spider middleware, instantiated by Scrapy.Most Scrapy components are instantiated with the
create_instance(Scrapy 2.11-) /build_from_crawler(Scrapy 2.12+) functions, which callfrom_crawlerif defined. Spider middlewares are definitely one of those components. So__init__should never be called without first callingfrom_crawler.It does happen in tests, that use
self.mwcls(), and would need to change to either usefrom_crawleror, better yet, usecreate_instance/build_from_crawler.