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

refactor(validators): Optimize imports

Karim shoair0fe04e499fed
diff --git a/scrapling/engines/_browsers/_validators.py b/scrapling/engines/_browsers/_validators.py
index 9b1b127..48a073e 100644
--- a/scrapling/engines/_browsers/_validators.py
+++ b/scrapling/engines/_browsers/_validators.py
@@ -1,4 +1,4 @@
-import msgspec
+from msgspec import Struct, convert, ValidationError
from urllib.parse import urlparse
from scrapling.core._types import (
@@ -12,7 +12,7 @@ from scrapling.core._types import (
from scrapling.engines.toolbelt import construct_proxy_dict
-class PlaywrightConfig(msgspec.Struct, kw_only=True, frozen=False):
+class PlaywrightConfig(Struct, kw_only=True, frozen=False):
"""Configuration struct for validation"""
max_pages: int = 1
@@ -81,8 +81,8 @@ class PlaywrightConfig(msgspec.Struct, kw_only=True, frozen=False):
def validate(params, model):
try:
- config = msgspec.convert(params, model)
- except msgspec.ValidationError as e:
+ config = convert(params, model)
+ except ValidationError as e:
raise TypeError(f"Invalid argument type: {e}")
return config