MCPcopy
hub / github.com/scrapy/scrapy / load_settings

Method load_settings

scrapy/addons.py:25–55  ·  view source on GitHub ↗

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 ``ADDONS`` setting and execute their ``update_settings`` methods. :param settings: The :class:`~scrapy.settings.Settings` object from \

(self, settings: Settings)

Source from the content-addressed store, hash-verified

23 self.addons: list[Any] = []
24
25 def load_settings(self, settings: Settings) -> None:
26 """Load add-ons and configurations from a settings object and apply them.
27
28 This will load the add-on for every add-on path in the
29 ``ADDONS`` setting and execute their ``update_settings`` methods.
30
31 :param settings: The :class:`~scrapy.settings.Settings` object from \
32 which to read the add-on configuration
33 :type settings: :class:`~scrapy.settings.Settings`
34 """
35 for clspath in build_component_list(settings["ADDONS"]):
36 try:
37 addoncls = load_object(clspath)
38 addon = build_from_crawler(addoncls, self.crawler)
39 if hasattr(addon, "update_settings"):
40 addon.update_settings(settings)
41 self.addons.append(addon)
42 except NotConfigured as e:
43 if e.args:
44 logger.warning(
45 "Disabled %(clspath)s: %(eargs)s",
46 {"clspath": clspath, "eargs": e.args[0]},
47 extra={"crawler": self.crawler},
48 )
49 logger.info(
50 "Enabled addons:\n%(addons)s",
51 {
52 "addons": self.addons,
53 },
54 extra={"crawler": self.crawler},
55 )
56
57 @classmethod
58 def load_pre_crawler_settings(cls, settings: BaseSettings) -> None:

Callers 1

_apply_settingsMethod · 0.80

Calls 5

build_component_listFunction · 0.90
load_objectFunction · 0.90
build_from_crawlerFunction · 0.90
infoMethod · 0.80
update_settingsMethod · 0.45

Tested by

no test coverage detected