Skip to content

Commit

Permalink
Set REQUEST_FINGERPRINTER_IMPLEMENTATION only on Scrapy < 2.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
wRAR committed Nov 19, 2024
1 parent a6d8388 commit 380fefd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from os import environ
from typing import Any, Dict, Optional

from packaging.version import Version
from scrapy import Spider
from scrapy import __version__ as SCRAPY_VERSION
from scrapy.crawler import Crawler
from scrapy.utils.misc import load_object
from scrapy.utils.test import get_crawler as _get_crawler
Expand All @@ -25,13 +27,16 @@
"scrapy_zyte_api.ScrapyZyteAPISessionDownloaderMiddleware": 667,
},
"REQUEST_FINGERPRINTER_CLASS": "scrapy_zyte_api.ScrapyZyteAPIRequestFingerprinter",
"REQUEST_FINGERPRINTER_IMPLEMENTATION": "2.7", # Silence deprecation warning
"SPIDER_MIDDLEWARES": {
"scrapy_zyte_api.ScrapyZyteAPISpiderMiddleware": 100,
},
"ZYTE_API_KEY": _API_KEY,
"TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
}
if Version(SCRAPY_VERSION) < Version("2.12"):
SETTINGS["REQUEST_FINGERPRINTER_IMPLEMENTATION"] = (
"2.7" # Silence deprecation warning
)
try:
import scrapy_poet # noqa: F401
except ImportError:
Expand Down

0 comments on commit 380fefd

Please sign in to comment.