Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Small improvements,

Andrey Rakhmatullinac201d310b81
diff --git a/docs/topics/spiders.rst b/docs/topics/spiders.rst
index 3197daf65..1ca7eda7b 100644
--- a/docs/topics/spiders.rst
+++ b/docs/topics/spiders.rst
@@ -142,7 +142,8 @@ scrapy.Spider
method, which is handy if you want to modify them based on
arguments. As a consequence, these settings aren't the final values
as they can be modified later by e.g. :ref:`add-ons
- <topics-addons>`. The settings become final when the spider starts.
+ <topics-addons>`. The final settings are available in the
+ :meth:`start_requests` method and later.
:param crawler: crawler to which the spider will be bound
:type crawler: :class:`~scrapy.crawler.Crawler` instance
diff --git a/scrapy/addons.py b/scrapy/addons.py
index 389a3cdde..9060d4f3f 100644
--- a/scrapy/addons.py
+++ b/scrapy/addons.py
@@ -19,7 +19,7 @@ class AddonManager:
self.crawler: "Crawler" = crawler
self.addons: List[Any] = []
- def apply_settings(self, settings: Settings) -> None:
+ def load_settings(self, settings: Settings) -> None:
"""Load add-ons and configurations from a settings object and apply them.
This will load the add-on for every add-on path in the
diff --git a/scrapy/crawler.py b/scrapy/crawler.py
index ee4d6fd59..22fd65be7 100644
--- a/scrapy/crawler.py
+++ b/scrapy/crawler.py
@@ -79,7 +79,6 @@ class Crawler:
self._init_reactor: bool = init_reactor
self.crawling: bool = False
- self._settings_loaded: bool = False
self._started: bool = False
self.extensions: Optional[ExtensionManager] = None
@@ -95,11 +94,10 @@ class Crawler:
install_scrapy_root_handler(self.settings)
def _apply_settings(self) -> None:
- if self._settings_loaded:
+ if self.settings.frozen:
return
- self._settings_loaded = True
- self.addons.apply_settings(self.settings)
+ self.addons.load_settings(self.settings)
self.stats = load_object(self.settings["STATS_CLASS"])(self)
handler = LogCounterHandler(self, level=self.settings.get("LOG_LEVEL"))