🕷️ 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: improve error handling
Karim shoair13700e26924e
diff --git a/scrapling/cli.py b/scrapling/cli.pyindex 940c27d..7b5d703 100644--- a/scrapling/cli.py+++ b/scrapling/cli.py@@ -55,11 +55,12 @@ def __ParseExtractArguments() -> Tuple[Dict[str, str], Dict[str, str], Dict[str, str], Optional[Dict[str, str]]]:"""Parse arguments for extract command"""parsed_headers, parsed_cookies = _ParseHeaders(headers)- for key, value in _CookieParser(cookies):- try:- parsed_cookies[key] = value- except Exception as e:- raise ValueError(f"Could not parse cookies '{cookies}': {e}")+ if cookies:+ for key, value in _CookieParser(cookies):+ try:+ parsed_cookies[key] = value+ except Exception as e:+ raise ValueError(f"Could not parse cookies '{cookies}': {e}")parsed_json = __ParseJSONData(json)parsed_params = {}diff --git a/scrapling/core/shell.py b/scrapling/core/shell.pyindex 13f604a..5020194 100644--- a/scrapling/core/shell.py+++ b/scrapling/core/shell.py@@ -207,11 +207,14 @@ class CurlParser:try:parsed_args, unknown = self.parser.parse_known_args(tokens)if unknown:- log.warning(f"Ignored unknown curl arguments: {unknown}")+ raise AttributeError(f"Unknown/Unsupported curl arguments: {unknown}")except ValueError:return None+ except AttributeError:+ raise+except Exception as e:log.error(f"An unexpected error occurred during curl arguments parsing: {e}"