MCPcopy
hub / github.com/scrapy/scrapy / get

Method get

scrapy/settings/__init__.py:146–173  ·  view source on GitHub ↗

Get a setting value without affecting its original type. :param name: the setting name :type name: str :param default: the value to return if no setting is found :type default: object

(self, name: _SettingsKey, default: Any = None)

Source from the content-addressed store, hash-verified

144 self.set(name, [v for v in value if v != item], self.getpriority(name) or 0)
145
146 def get(self, name: _SettingsKey, default: Any = None) -> Any: # pylint: disable=arguments-renamed
147 """
148 Get a setting value without affecting its original type.
149
150 :param name: the setting name
151 :type name: str
152
153 :param default: the value to return if no setting is found
154 :type default: object
155 """
156 if name == "CONCURRENT_REQUESTS_PER_IP" and (
157 isinstance(self[name], int) and self[name] != 0
158 ):
159 warnings.warn(
160 "The CONCURRENT_REQUESTS_PER_IP setting is deprecated, use CONCURRENT_REQUESTS_PER_DOMAIN instead.",
161 ScrapyDeprecationWarning,
162 stacklevel=2,
163 )
164
165 if name == "DNS_RESOLVER":
166 warnings.warn(
167 "The DNS_RESOLVER setting is deprecated, please use "
168 "TWISTED_DNS_RESOLVER instead.",
169 ScrapyDeprecationWarning,
170 stacklevel=2,
171 )
172
173 return self[name] if self[name] is not None else default
174
175 def getbool(self, name: _SettingsKey, default: bool = False) -> bool:
176 """

Callers 12

getboolMethod · 0.95
getintMethod · 0.95
getfloatMethod · 0.95
getlistMethod · 0.95
getdictMethod · 0.95
getdictorlistMethod · 0.95
_get_sitemap_bodyMethod · 0.45
iterlocFunction · 0.45
restore_keyMethod · 0.45
__init__Method · 0.45
policyMethod · 0.45
process_spider_inputMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected