Scrapy, a fast high-level web crawling & scraping framework for Python.
Prevent scrapy shell from starting spider requests (#7557)
msn93a627ba1c9a
diff --git a/scrapy/shell.py b/scrapy/shell.pyindex 44e542470..0bd71feb2 100644--- a/scrapy/shell.py+++ b/scrapy/shell.py@@ -28,11 +28,7 @@ from scrapy.spiders import Spiderfrom scrapy.utils.conf import get_configfrom scrapy.utils.console import DEFAULT_PYTHON_SHELLS, start_python_consolefrom scrapy.utils.datatypes import SequenceExclude-from scrapy.utils.defer import (- _schedule_coro,- deferred_f_from_coro_f,- maybe_deferred_to_future,-)+from scrapy.utils.defer import deferred_f_from_coro_f, maybe_deferred_to_futurefrom scrapy.utils.misc import load_objectfrom scrapy.utils.reactor import is_asyncio_reactor_installed, set_asyncio_event_loopfrom scrapy.utils.response import open_in_browser@@ -69,8 +65,8 @@ if TYPE_CHECKING:# 3. When fetch() is called, it prepares a request and calls Shell._schedule()# in the reactor thread (via threads.blockingCallFromThread()).# 4. Shell._schedule() calls Shell._open_spider() (on the first call).-# 5. Shell._open_spider() calls engine.open_spider_async(close_if_idle=False)-# and engine._start_request_processing().+# 5. Shell._open_spider() calls+# engine.open_spider_async(close_if_idle=False).# 6. Shell._schedule() calls engine.crawl(request), scheduling the request.# 7. Shell._schedule() via _request_deferred() waits until the request callback# is called. When it's called, the response becomes available.@@ -214,7 +210,6 @@ class Shell:self.crawler.spider = spiderassert self.crawler.engineawait self.crawler.engine.open_spider_async(close_if_idle=False)- _schedule_coro(self.crawler.engine._start_request_processing())self.spider = spiderdef fetch(