🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
fix: make `retry_blocked_request` take the response as well
Karim shoair5a11c2466b03
diff --git a/scrapling/spiders/engine.py b/scrapling/spiders/engine.pyindex 83cafb3..26fce1e 100644--- a/scrapling/spiders/engine.py+++ b/scrapling/spiders/engine.py@@ -82,7 +82,7 @@ class CrawlerEngine:retry_request._retry_count += 1retry_request.priority -= 1 # Don't retry immediatelyretry_request.dont_filter = True- new_request = await self.spider.retry_blocked_request(retry_request)+ new_request = await self.spider.retry_blocked_request(retry_request, response)await self.scheduler.enqueue(new_request)log.debug(f"Scheduled blocked request for retry ({retry_request._retry_count}/{self.spider.max_blocked_retries}): {request.url}"diff --git a/scrapling/spiders/spider.py b/scrapling/spiders/spider.pyindex 5333f50..5f3268e 100644--- a/scrapling/spiders/spider.py+++ b/scrapling/spiders/spider.py@@ -162,7 +162,7 @@ class Spider(ABC):return Truereturn False- async def retry_blocked_request(self, request: Request) -> Request:+ async def retry_blocked_request(self, request: Request, response: "Response") -> Request:"""Users should override this to prepare the blocked request before retrying, if needed."""return request