Skip to content

Commit 0f9127e

Browse files
authored
v0.3.11
2 parents ab0be95 + 51d3472 commit 0f9127e

6 files changed

Lines changed: 11 additions & 16 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[project]
66
name = "scrapling"
77
# Static version instead of a dynamic version so we can get better layer caching while building docker, check the docker file to understand
8-
version = "0.3.10"
8+
version = "0.3.11"
99
description = "Scrapling is an undetectable, powerful, flexible, high-performance Python library that makes Web Scraping easy and effortless as it should be!"
1010
readme = {file = "docs/README.md", content-type = "text/markdown"}
1111
license = {file = "LICENSE"}
@@ -74,7 +74,7 @@ fetchers = [
7474
"msgspec>=0.20.0",
7575
]
7676
ai = [
77-
"mcp>=1.19.0",
77+
"mcp>=1.23.0",
7878
"markdownify>=1.2.0",
7979
"scrapling[fetchers]",
8080
]

scrapling/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "Karim Shoair (karim.shoair@pm.me)"
2-
__version__ = "0.3.10"
2+
__version__ = "0.3.11"
33
__copyright__ = "Copyright (c) 2024 Karim Shoair"
44

55
from typing import Any, TYPE_CHECKING

scrapling/core/shell.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,15 @@ def convert2fetcher(self, curl_command: Request | str) -> Optional[Response]:
314314
return None
315315

316316

317-
def _unpack_signature(func):
317+
def _unpack_signature(func, signature_name=None):
318318
"""
319319
Unpack TypedDict from Unpack[TypedDict] annotations in **kwargs and reconstruct the signature.
320320
321321
This allows the interactive shell to show individual parameters instead of just **kwargs, similar to how IDEs display them.
322322
"""
323323
try:
324324
sig = signature(func)
325-
func_name = getattr(func, "__name__", None)
325+
func_name = signature_name or getattr(func, "__name__", None)
326326

327327
# Check if this function has known parameters
328328
if func_name not in Signatures_map:
@@ -467,7 +467,7 @@ def update_page(self, result): # pragma: no cover
467467

468468
return result
469469

470-
def create_wrapper(self, func, get_signature=True):
470+
def create_wrapper(self, func, get_signature=True, signature_name=None):
471471
"""Create a wrapper that preserves function signature but updates page"""
472472

473473
@wraps(func)
@@ -477,7 +477,7 @@ def wrapper(*args, **kwargs):
477477

478478
if get_signature:
479479
# Explicitly preserve and unpack signature for IPython introspection and autocompletion
480-
wrapper.__signature__ = _unpack_signature(func) # pyright: ignore
480+
wrapper.__signature__ = _unpack_signature(func, signature_name) # pyright: ignore
481481
else:
482482
wrapper.__signature__ = signature(func) # pyright: ignore
483483

@@ -492,7 +492,7 @@ def get_namespace(self):
492492
put = self.create_wrapper(self.__Fetcher.put)
493493
delete = self.create_wrapper(self.__Fetcher.delete)
494494
dynamic_fetch = self.create_wrapper(self.__DynamicFetcher.fetch)
495-
stealthy_fetch = self.create_wrapper(self.__StealthyFetcher.fetch)
495+
stealthy_fetch = self.create_wrapper(self.__StealthyFetcher.fetch, signature_name="stealthy_fetch")
496496
curl2fetcher = self.create_wrapper(self._curl_parser.convert2fetcher, get_signature=False)
497497

498498
# Create the namespace dictionary

scrapling/engines/_browsers/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _wait_for_networkidle(page: Page | Frame, timeout: Optional[int] = None):
105105
"""Wait for the page to become idle (no network activity) even if there are never-ending requests."""
106106
try:
107107
page.wait_for_load_state("networkidle", timeout=timeout)
108-
except PlaywrightError:
108+
except (PlaywrightError, Exception):
109109
pass
110110

111111
def _wait_for_page_stability(self, page: Page | Frame, load_dom: bool, network_idle: bool):
@@ -221,7 +221,7 @@ async def _wait_for_networkidle(page: AsyncPage | AsyncFrame, timeout: Optional[
221221
"""Wait for the page to become idle (no network activity) even if there are never-ending requests."""
222222
try:
223223
await page.wait_for_load_state("networkidle", timeout=timeout)
224-
except PlaywrightError:
224+
except (PlaywrightError, Exception):
225225
pass
226226

227227
async def _wait_for_page_stability(self, page: AsyncPage | AsyncFrame, load_dom: bool, network_idle: bool):

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = scrapling
3-
version = 0.3.10
3+
version = 0.3.11
44
author = Karim Shoair
55
author_email = karim.shoair@pm.me
66
description = Scrapling is an undetectable, powerful, flexible, high-performance Python library that makes Web Scraping easy and effortless as it should be!

tox.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ deps =
1515
camoufox
1616
-r{toxinidir}/tests/requirements.txt
1717
extras = ai,shell
18-
commands_pre =
19-
# Install browsers in the tox virtual environment
20-
python -m playwright install chromium
21-
python -m playwright install-deps chromium firefox
22-
python -m camoufox fetch --browserforge
2318
commands =
2419
# Run browser tests without parallelization (avoid browser conflicts)
2520
pytest --cov=scrapling --cov-report=xml -k "DynamicFetcher or StealthyFetcher" --verbose

0 commit comments

Comments
 (0)