Skip to content

Commit b1774f1

Browse files
committed
using getbool and getlist to get the values from spider.settings
1 parent 6630960 commit b1774f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/scrapy_settings_log/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def spider_closed(self, spider):
5151
regex = settings.get("SETTINGS_LOGGING_REGEX")
5252
if regex is not None:
5353
settings = {k: v for k, v in settings.items() if re.search(regex, k)}
54-
if settings.get("MASKED_SENSITIVE_SETTINGS_ENABLED", True):
54+
if spider.settings.getbool("MASKED_SENSITIVE_SETTINGS_ENABLED", True):
5555
default_regexes = [
5656
".*(?i)(api[\W_]*key).*", # apikey and possible variations e.g: shub_apikey or SC_APIKEY
5757
".*(?i)(AWS[\W_]*SECRET[\W_]*ACCESS[\W_]*KEY).*", # AWS_SECRET_ACCESS_KEY and possible variations
5858
".*(?i)([\W_]*password[\W_]*).*" # password word
5959
]
60-
regex_list = settings.get("MASKED_SENSITIVE_SETTINGS_REGEX_LIST", default_regexes)
60+
regex_list = spider.settings.getlist("MASKED_SENSITIVE_SETTINGS_REGEX_LIST", default_regexes)
6161
for reg in regex_list:
6262
updated_settings = {k: '**********' if v else v for k, v in settings.items() if re.match(reg, k)}
6363
settings = {**settings, **updated_settings}

0 commit comments

Comments
 (0)