mirror of https://github.com/scrapy/scrapy.git
Small improvements,
This commit is contained in:
parent
61ef37a594
commit
ac201d310b
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue