From f5f593e5f5e2b0c216e9d6fd41f4260f70c74d34 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sun, 6 Aug 2023 17:46:28 +0400 Subject: [PATCH] Remove a workaround for a w3lib typing bug. --- scrapy/utils/response.py | 3 +-- tox.ini | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scrapy/utils/response.py b/scrapy/utils/response.py index 794678c48..c540d6278 100644 --- a/scrapy/utils/response.py +++ b/scrapy/utils/response.py @@ -42,8 +42,7 @@ def get_meta_refresh( """Parse the http-equiv refresh parameter from the given response""" if response not in _metaref_cache: text = response.text[0:4096] - # a w3lib typing bug here, fixed in https://github.com/scrapy/w3lib/pull/211 - _metaref_cache[response] = html.get_meta_refresh( # type: ignore[assignment] + _metaref_cache[response] = html.get_meta_refresh( text, response.url, response.encoding, ignore_tags=ignore_tags ) return _metaref_cache[response] diff --git a/tox.ini b/tox.ini index ef7dd5854..8b2d207c7 100644 --- a/tox.ini +++ b/tox.ini @@ -41,6 +41,8 @@ deps = types-Pygments==2.15.0.1 types-pyOpenSSL==23.2.0.1 types-setuptools==68.0.0.1 + # 2.1.2 fixes a typing bug: https://github.com/scrapy/w3lib/pull/211 + w3lib >= 2.1.2 commands = mypy {posargs: scrapy tests}