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

Scrapy parse doesn't support async callbacks with yield #5819

Closed
GKukulski opened this issue Jan 31, 2023 · 2 comments · Fixed by #5824
Closed

Scrapy parse doesn't support async callbacks with yield #5819

GKukulski opened this issue Jan 31, 2023 · 2 comments · Fixed by #5824

Comments

@GKukulski
Copy link

When running scrapy parse http://localhost:8080 -c parse --spider test is rising error: TypeError: 'async_generator' object is not iterable.

Simple Code of Spider:

import scrapy

class TestSpider(scrapy.Spider):
    name = 'test'
    allowed_domains = ['localhost']
    start_urls = ['http://localhost:8080']

    async def parse(self, response):
        for x in range(1, 5):
            yield ({"test": x})

It is happened when there is yield inside async function.

scrapy crawl test - works fine

@Gallaecio Gallaecio added the bug label Jan 31, 2023
@Gallaecio
Copy link
Member

I can confirm this issue, and I don’t think it is a regression, because even with the commit that is meant to fix it, and includes a test for it, I can reproduce the issue (commit 0435751, and passing an extra command line to get that commit working: -s REQUEST_FINGERPRINTER_IMPLEMENTATION=PREVIOUS_VERSION).

@wRAR
Copy link
Member

wRAR commented Jan 31, 2023

The PR (#5577) indeed only tests async def callbacks without a yield (explicitly, as that test callback returns a list).

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

Successfully merging a pull request may close this issue.

3 participants