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

build: Move click library to be part of the fetchers extra

Karim shoairfdac239fcc4a
diff --git a/pyproject.toml b/pyproject.toml
index 5c708f3..53f5a4c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -58,13 +58,13 @@ classifiers = [
dependencies = [
"lxml>=6.0.1",
"cssselect>=1.3.0",
- "click>=8.2.1",
"orjson>=3.11.3",
"tldextract>=5.3.0",
]
[project.optional-dependencies]
fetchers = [
+ "click>=8.2.1",
"curl_cffi>=0.13.0",
"playwright>=1.52.0",
"rebrowser-playwright>=1.52.0",
diff --git a/scrapling/cli.py b/scrapling/cli.py
index 3e052ac..0b68721 100644
--- a/scrapling/cli.py
+++ b/scrapling/cli.py
@@ -7,7 +7,13 @@ from scrapling.core.utils import log, _CookieParser, _ParseHeaders
from scrapling.core._types import List, Optional, Dict, Tuple, Any, Callable
from orjson import loads as json_loads, JSONDecodeError
-from click import command, option, Choice, group, argument
+
+try:
+ from click import command, option, Choice, group, argument
+except ImportError:
+ raise ImportError(
+ "You need to install scrapling with any of the extras to enable Shell commands. See: https://scrapling.readthedocs.io/en/latest/#installation"
+ )
__OUTPUT_FILE_HELP__ = "The output file path can be an HTML file, a Markdown file of the HTML content, or the text content itself. Use file extensions (`.html`/`.md`/`.txt`) respectively."
__PACKAGE_DIR__ = Path(__file__).parent