ExecutionEngine
这个 Engine 负责的是系统中所有组件之间的数据流转与交互。
ExecutionEngine
是Engine
的实例,它会初始化Schedule
、Slot
、Downloader
(Downloader Middlewares
)、Scraper
(Spider Middlewares
、itempipline
)、Stats
等,并对其进行管理、控制。
源码解析
scrapy/crawler.py#Crawler crawl(self, *args, **kwargs)
scrapy/core/engine.py#ExecutionEngine open_spider(self, spider: Spider, start_requests: Iterable = (), close_if_idle: bool = True)
scrapy/core/engine.py#ExecutionEngine start(self) -> Deferred
scrapy/core/engine.py#ExecutionEngine close(self) -> Deferred
scrapy/core/engine.py#ExecutionEngine stop(self) -> Deferred