Skip to content
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

Add process_spider_output_async() to the spider middleware. #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wRAR
Copy link
Member

@wRAR wRAR commented Dec 27, 2024

Fixes #72.

I wonder how can we test the change on Scrapy Cloud before merging this though?

@Gallaecio
Copy link
Member

Gallaecio commented Dec 27, 2024

I wonder how can we test the change on Scrapy Cloud before merging this though?

I believe you can install a newer version of the entrypoint through requirements.txt, the only thing that does not update properly is the execution of binaries I think.

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import itertools
from warnings import warn
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the call in HubstorageDownloaderMiddleware.from_crawler(), added in some older change.

@@ -28,11 +29,22 @@ def process_spider_output(self, response, result, spider):
parent = self._seen_requests.pop(response.request, None)
for x in result:
if isinstance(x, Request):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check not extracted because we tentatively decided that as a general pattern for such middlewares we prefer to separate "process_request" and "process_item" logic.

sh_scrapy/middlewares.py Outdated Show resolved Hide resolved
@wRAR
Copy link
Member Author

wRAR commented Jan 6, 2025

I confirmed this works (if the project has an async middleware, there is a warning normally and no warning if this branch is installed explicitly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spider middlewares are not async compatible
3 participants