看起来我走到了死胡同。有没有办法在asyncio循环内运行scrapy爬虫?例如下面的代码:
import asyncio
from scrapy.crawler import CrawlerProcess
from myscrapy import MySpider
import scrapy
async def do_some_work():
process = CrawlerProcess()
await process.crawl(MySpider)
loop = asyncio.get_even_loop()
loop.run_until_complete(do_some_work())
这让我想到了错误:
raise TypeError('A Future, a coroutine or an awaitable is required')
TypeError: A Future, a coroutine or an awaitable is required
我知道在await之后应该有另一个协程。是否有任何方法可以绕过它,仍然使其异步工作?谢谢。