Closes #6342. Setting METAREFRESH_IGNORE_TAGS to [‘noscript’] by default

This commit is contained in:
aisha-partha 2024-05-08 22:06:46 +05:30
parent 4300a1d240
commit 180bc9bad7
3 changed files with 5 additions and 6 deletions

View File

@ -876,13 +876,13 @@ Whether the Meta Refresh middleware will be enabled.
METAREFRESH_IGNORE_TAGS
^^^^^^^^^^^^^^^^^^^^^^^
Default: ``[]``
Default: ``['noscript']``
Meta tags within these tags are ignored.
.. versionchanged:: 2.0
The default value of :setting:`METAREFRESH_IGNORE_TAGS` changed from
``['script', 'noscript']`` to ``[]``.
``[]`` to ``['noscript']``.
.. setting:: METAREFRESH_MAXDELAY

View File

@ -239,7 +239,7 @@ MEMUSAGE_NOTIFY_MAIL = []
MEMUSAGE_WARNING_MB = 0
METAREFRESH_ENABLED = True
METAREFRESH_IGNORE_TAGS = []
METAREFRESH_IGNORE_TAGS = ["noscript"]
METAREFRESH_MAXDELAY = 100
NEWSPIDER_MODULE = ""

View File

@ -395,9 +395,8 @@ class MetaRefreshMiddlewareTest(unittest.TestCase):
"""content="0;URL='http://example.org/newpage'"></noscript>"""
)
rsp = HtmlResponse(req.url, body=body.encode())
req2 = self.mw.process_response(req, rsp, self.spider)
assert isinstance(req2, Request)
self.assertEqual(req2.url, "http://example.org/newpage")
response = self.mw.process_response(req, rsp, self.spider)
assert isinstance(response, Response)
def test_ignore_tags_1_x_list(self):
"""Test that Scrapy 1.x behavior remains possible"""