[common] use util.re_compile() in _dump_response

This commit is contained in:
Mike Fährmann
2025-06-05 15:24:22 +02:00
parent d7d99d5606
commit 72a01bc4d4

View File

@@ -663,7 +663,7 @@ class Extractor():
util.dump_json(obj, ensure_ascii=False, indent=2)
def _dump_response(self, response, history=True):
"""Write the response content to a .dump file in the current directory.
"""Write the response content to a .txt file in the current directory.
The file name is derived from the response url,
replacing special characters with "_"
@@ -676,7 +676,8 @@ class Extractor():
Extractor._dump_index += 1
else:
Extractor._dump_index = 1
Extractor._dump_sanitize = re.compile(r"[\\\\|/<>:\"?*&=#]+").sub
Extractor._dump_sanitize = util.re_compile(
r"[\\\\|/<>:\"?*&=#]+").sub
fname = "{:>02}_{}".format(
Extractor._dump_index,