MCPcopy
hub / github.com/scrapy/scrapy / _apply_reactorless_default_settings

Method _apply_reactorless_default_settings

scrapy/crawler.py:154–166  ·  view source on GitHub ↗

Change some setting defaults when not using a Twisted reactor. Some settings need different defaults when using and not using a reactor, but as we can't put this logic into default_settings.py we change them here when the reactor is not used.

(self)

Source from the content-addressed store, hash-verified

152 )
153
154 def _apply_reactorless_default_settings(self) -> None:
155 """Change some setting defaults when not using a Twisted reactor.
156
157 Some settings need different defaults when using and not using a
158 reactor, but as we can't put this logic into default_settings.py we
159 change them here when the reactor is not used.
160 """
161 self.settings.set("TELNETCONSOLE_ENABLED", False, priority="default")
162 for scheme in ("http", "https"):
163 self.settings["DOWNLOAD_HANDLERS_BASE"][scheme] = (
164 "scrapy.core.downloader.handlers._httpx.HttpxDownloadHandler"
165 )
166 self.settings["DOWNLOAD_HANDLERS_BASE"]["ftp"] = None
167
168 # Cannot use @deferred_f_from_coro_f because that relies on the reactor
169 # being installed already, which is done within _apply_settings(), inside

Callers 1

_apply_settingsMethod · 0.95

Calls 1

setMethod · 0.45

Tested by

no test coverage detected