🕷️ 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: solve the response log issue so now you get log for every response from Fetchers
Karim shoair6652b8ac1833
diff --git a/scrapling/engines/toolbelt/custom.py b/scrapling/engines/toolbelt/custom.pyindex 62c8452..9705eb3 100644--- a/scrapling/engines/toolbelt/custom.py+++ b/scrapling/engines/toolbelt/custom.py@@ -84,8 +84,6 @@ class ResponseEncoding:class Response(Adaptor):"""This class is returned by all engines as a way to unify response type between different libraries."""- _is_response_result_logged = False # Class-level flag, initialized to False-def __init__(self, url: str, text: str, body: bytes, status: int, reason: str, cookies: Dict, headers: Dict, request_headers: Dict,encoding: str = 'utf-8', method: str = 'GET', **adaptor_arguments: Dict):automatch_domain = adaptor_arguments.pop('automatch_domain', None)@@ -99,9 +97,7 @@ class Response(Adaptor):# For back-ward compatibilityself.adaptor = self# For easier debugging while working from a Python shell- if not Response._is_response_result_logged:- log.info(f'Fetched ({status}) <{method} {url}> (referer: {request_headers.get("referer")})')- Response._is_response_result_logged = True+ log.info(f'Fetched ({status}) <{method} {url}> (referer: {request_headers.get("referer")})')# def __repr__(self):# return f'<{self.__class__.__name__} [{self.status} {self.reason}]>'diff --git a/scrapling/parser.py b/scrapling/parser.pyindex 5440a84..c82a270 100644--- a/scrapling/parser.py+++ b/scrapling/parser.py@@ -155,7 +155,7 @@ class Adaptor(SelectorsGeneration):else:if issubclass(type(element), html.HtmlMixin):- return self.__class__(+ return Adaptor(root=element,text='', body=b'', # Since root argument is provided, both `text` and `body` will be ignored so this is just a fillerurl=self.url, encoding=self.encoding, auto_match=self.__auto_match_enabled,