Skip to content

Commit

Permalink
Fix remnants of when check() parameters were reversed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Jun 28, 2024
1 parent 2209d84 commit 73a5f0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/reference/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Example:
class MySessionChecker:
def check(self, request: Request, response: Response) -> bool:
def check(self, response: Response, request: Request) -> bool:
return bool(response.css(".is_valid"))
Expand All @@ -330,7 +330,7 @@ object, for example to read settings:
location = crawler.settings["ZYTE_API_SESSION_LOCATION"]
self.postal_code = location["postalCode"]
def check(self, request: Request, response: Response) -> bool:
def check(self, response: Response, request: Request) -> bool:
return response.css(".postal_code::text").get() == self.postal_code
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def closed(self, reason):

class CloseSpiderURLChecker:

def check(self, request: Request, response: Response) -> bool:
def check(self, response: Response, request: Request) -> bool:
if "fail" in request.url:
raise CloseSpider("closed_by_checker")
return True
Expand Down Expand Up @@ -829,7 +829,7 @@ def parse(self, response):

class DomainChecker:

def check(self, request: Request, response: Response) -> bool:
def check(self, response: Response, request: Request) -> bool:
domain = urlparse_cached(request).netloc
return "fail" not in domain

Expand Down

0 comments on commit 73a5f0c

Please sign in to comment.