🕷️ 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
refactor: internal API changes
Karim shoairf80e8828f781
diff --git a/scrapling/engines/static.py b/scrapling/engines/static.pyindex 2386820..ca7c7a6 100644--- a/scrapling/engines/static.py+++ b/scrapling/engines/static.py@@ -600,6 +600,7 @@ class FetcherSession:"_default_http3","selector_config","_client",+ "_is_alive",)def __init__(@@ -653,6 +654,7 @@ class FetcherSession:self._default_cert = certself._default_http3 = http3self.selector_config = selector_config or {}+ self._is_alive = Falseself._client: _SyncSessionLogic | _ASyncSessionLogic | None = Nonedef __enter__(self) -> _SyncSessionLogic:@@ -663,6 +665,7 @@ class FetcherSession:config["stealthy_headers"] = self._stealthconfig["selector_config"] = self.selector_configself._client = _SyncSessionLogic(**config)+ self._is_alive = Truereturn self._client.__enter__()raise RuntimeError("This FetcherSession instance already has an active synchronous session.")@@ -670,6 +673,7 @@ class FetcherSession:if self._client is not None and isinstance(self._client, _SyncSessionLogic):self._client.__exit__(exc_type, exc_val, exc_tb)self._client = None+ self._is_alive = Falsereturnraise RuntimeError("Cannot exit invalid session")@@ -681,6 +685,7 @@ class FetcherSession:config["stealthy_headers"] = self._stealthconfig["selector_config"] = self.selector_configself._client = _ASyncSessionLogic(**config)+ self._is_alive = Truereturn await self._client.__aenter__()raise RuntimeError("This FetcherSession instance already has an active asynchronous session.")@@ -688,6 +693,7 @@ class FetcherSession:if self._client is not None and isinstance(self._client, _ASyncSessionLogic):await self._client.__aexit__(exc_type, exc_val, exc_tb)self._client = None+ self._is_alive = Falsereturnraise RuntimeError("Cannot exit invalid session")