Skip to content

🕷️ 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

fix(spiders engine): Improve logging

Karim shoair41c7a7e7931e
diff --git a/scrapling/spiders/engine.py b/scrapling/spiders/engine.py
index 2b12683..e869e7f 100644
--- a/scrapling/spiders/engine.py
+++ b/scrapling/spiders/engine.py
@@ -85,7 +85,7 @@ class CrawlerEngine:
retry_request.dont_filter = True
new_request = await self.spider.retry_blocked_request(retry_request, response)
await self.scheduler.enqueue(new_request)
- log.debug(
+ log.info(
f"Scheduled blocked request for retry ({retry_request._retry_count}/{self.spider.max_blocked_retries}): {request.url}"
)
else:
@@ -108,6 +108,8 @@ class CrawlerEngine:
await self._item_stream.send(result)
await self.spider.on_scraped_item(result)
log.debug(f"Scraped from {str(response)}\n{result}")
+ elif result is not None:
+ log.error(f"Spider must return Request, dict or None, got '{type(result)}' in {request}")
except Exception as e:
await self.spider.on_error(request, e)