Skip to content

Commit

Permalink
Fix SplashAwareDupeFilter.__init__() (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
protokoul authored Jan 27, 2025
1 parent 2b59f2e commit bef8bf3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scrapy_splash/dupefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To handle "splash" Request meta key properly a custom DupeFilter must be set.
See https://github.com/scrapy/scrapy/issues/900 for more info.
"""
from __future__ import absolute_import
from __future__ import absolute_import, annotations
from copy import deepcopy
import hashlib
from weakref import WeakKeyDictionary
Expand All @@ -13,6 +13,7 @@

from scrapy.utils.python import to_bytes
from scrapy.utils.url import canonicalize_url
from scrapy.utils.request import RequestFingerprinterProtocol

from .utils import dict_hash

Expand Down Expand Up @@ -119,7 +120,13 @@ class SplashAwareDupeFilter(RFPDupeFilter):
It should be used with SplashMiddleware.
"""

def __init__(self):
def __init__(
self,
path: str | None = None,
debug: bool = False,
*,
fingerprinter: RequestFingerprinterProtocol | None = None
):
warn(
(
"SplashAwareDupeFilter is deprecated. Set "
Expand All @@ -129,6 +136,7 @@ def __init__(self):
DeprecationWarning,
stacklevel=2,
)
super().__init__(path, debug, fingerprinter)

def request_fingerprint(self, request):
return splash_request_fingerprint(request)

0 comments on commit bef8bf3

Please sign in to comment.