Karim shoair commited on
Commit ·
11d2ff6
1
Parent(s): f16f8b8
docs(cli): Correcting docstrings
Browse files- scrapling/cli.py +15 -15
scrapling/cli.py
CHANGED
|
@@ -11,7 +11,7 @@ from scrapling.core.shell import Convertor, _CookieParser, _ParseHeaders
|
|
| 11 |
from orjson import loads as json_loads, JSONDecodeError
|
| 12 |
from click import command, option, Choice, group, argument
|
| 13 |
|
| 14 |
-
__OUTPUT_FILE_HELP__ = "
|
| 15 |
__PACKAGE_DIR__ = Path(__file__).parent
|
| 16 |
|
| 17 |
|
|
@@ -179,7 +179,7 @@ def extract():
|
|
| 179 |
|
| 180 |
|
| 181 |
@extract.command(
|
| 182 |
-
help=f"Perform a GET request and save content to file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 183 |
)
|
| 184 |
@argument("url", required=True)
|
| 185 |
@argument("output_file", required=True)
|
|
@@ -197,7 +197,7 @@ def extract():
|
|
| 197 |
@option(
|
| 198 |
"--css-selector",
|
| 199 |
"-s",
|
| 200 |
-
help="CSS selector to extract specific content from the page. It
|
| 201 |
)
|
| 202 |
@option(
|
| 203 |
"--params",
|
|
@@ -236,7 +236,7 @@ def get(
|
|
| 236 |
stealthy_headers,
|
| 237 |
):
|
| 238 |
"""
|
| 239 |
-
Perform a GET request and save content to file.
|
| 240 |
|
| 241 |
:param url: Target URL for the request.
|
| 242 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
@@ -268,7 +268,7 @@ def get(
|
|
| 268 |
|
| 269 |
|
| 270 |
@extract.command(
|
| 271 |
-
help=f"Perform a POST request and save content to file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 272 |
)
|
| 273 |
@argument("url", required=True)
|
| 274 |
@argument("output_file", required=True)
|
|
@@ -292,7 +292,7 @@ def get(
|
|
| 292 |
@option(
|
| 293 |
"--css-selector",
|
| 294 |
"-s",
|
| 295 |
-
help="CSS selector to extract specific content from the page. It
|
| 296 |
)
|
| 297 |
@option(
|
| 298 |
"--params",
|
|
@@ -333,7 +333,7 @@ def post(
|
|
| 333 |
stealthy_headers,
|
| 334 |
):
|
| 335 |
"""
|
| 336 |
-
Perform a POST request and save content to file.
|
| 337 |
|
| 338 |
:param url: Target URL for the request.
|
| 339 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
@@ -368,7 +368,7 @@ def post(
|
|
| 368 |
|
| 369 |
|
| 370 |
@extract.command(
|
| 371 |
-
help=f"Perform a PUT request and save content to file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 372 |
)
|
| 373 |
@argument("url", required=True)
|
| 374 |
@argument("output_file", required=True)
|
|
@@ -388,7 +388,7 @@ def post(
|
|
| 388 |
@option(
|
| 389 |
"--css-selector",
|
| 390 |
"-s",
|
| 391 |
-
help="CSS selector to extract specific content from the page. It
|
| 392 |
)
|
| 393 |
@option(
|
| 394 |
"--params",
|
|
@@ -429,7 +429,7 @@ def put(
|
|
| 429 |
stealthy_headers,
|
| 430 |
):
|
| 431 |
"""
|
| 432 |
-
Perform a PUT request and save content to file.
|
| 433 |
|
| 434 |
:param url: Target URL for the request.
|
| 435 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
@@ -464,7 +464,7 @@ def put(
|
|
| 464 |
|
| 465 |
|
| 466 |
@extract.command(
|
| 467 |
-
help=f"Perform a DELETE request and save content to file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 468 |
)
|
| 469 |
@argument("url", required=True)
|
| 470 |
@argument("output_file", required=True)
|
|
@@ -482,7 +482,7 @@ def put(
|
|
| 482 |
@option(
|
| 483 |
"--css-selector",
|
| 484 |
"-s",
|
| 485 |
-
help="CSS selector to extract specific content from the page. It
|
| 486 |
)
|
| 487 |
@option(
|
| 488 |
"--params",
|
|
@@ -521,7 +521,7 @@ def delete(
|
|
| 521 |
stealthy_headers,
|
| 522 |
):
|
| 523 |
"""
|
| 524 |
-
Perform a DELETE request and save content to file.
|
| 525 |
|
| 526 |
:param url: Target URL for the request.
|
| 527 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
@@ -587,7 +587,7 @@ def delete(
|
|
| 587 |
@option(
|
| 588 |
"--css-selector",
|
| 589 |
"-s",
|
| 590 |
-
help="CSS selector to extract specific content from the page. It
|
| 591 |
)
|
| 592 |
@option("--wait-selector", help="CSS selector to wait for before proceeding")
|
| 593 |
@option("--locale", default="en-US", help="Browser locale (default: en-US)")
|
|
@@ -736,7 +736,7 @@ def fetch(
|
|
| 736 |
@option(
|
| 737 |
"--css-selector",
|
| 738 |
"-s",
|
| 739 |
-
help="CSS selector to extract specific content from the page. It
|
| 740 |
)
|
| 741 |
@option("--wait-selector", help="CSS selector to wait for before proceeding")
|
| 742 |
@option(
|
|
|
|
| 11 |
from orjson import loads as json_loads, JSONDecodeError
|
| 12 |
from click import command, option, Choice, group, argument
|
| 13 |
|
| 14 |
+
__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."
|
| 15 |
__PACKAGE_DIR__ = Path(__file__).parent
|
| 16 |
|
| 17 |
|
|
|
|
| 179 |
|
| 180 |
|
| 181 |
@extract.command(
|
| 182 |
+
help=f"Perform a GET request and save the content to a file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 183 |
)
|
| 184 |
@argument("url", required=True)
|
| 185 |
@argument("output_file", required=True)
|
|
|
|
| 197 |
@option(
|
| 198 |
"--css-selector",
|
| 199 |
"-s",
|
| 200 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 201 |
)
|
| 202 |
@option(
|
| 203 |
"--params",
|
|
|
|
| 236 |
stealthy_headers,
|
| 237 |
):
|
| 238 |
"""
|
| 239 |
+
Perform a GET request and save the content to a file.
|
| 240 |
|
| 241 |
:param url: Target URL for the request.
|
| 242 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
|
|
| 268 |
|
| 269 |
|
| 270 |
@extract.command(
|
| 271 |
+
help=f"Perform a POST request and save the content to a file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 272 |
)
|
| 273 |
@argument("url", required=True)
|
| 274 |
@argument("output_file", required=True)
|
|
|
|
| 292 |
@option(
|
| 293 |
"--css-selector",
|
| 294 |
"-s",
|
| 295 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 296 |
)
|
| 297 |
@option(
|
| 298 |
"--params",
|
|
|
|
| 333 |
stealthy_headers,
|
| 334 |
):
|
| 335 |
"""
|
| 336 |
+
Perform a POST request and save the content to a file.
|
| 337 |
|
| 338 |
:param url: Target URL for the request.
|
| 339 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
|
|
| 368 |
|
| 369 |
|
| 370 |
@extract.command(
|
| 371 |
+
help=f"Perform a PUT request and save the content to a file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 372 |
)
|
| 373 |
@argument("url", required=True)
|
| 374 |
@argument("output_file", required=True)
|
|
|
|
| 388 |
@option(
|
| 389 |
"--css-selector",
|
| 390 |
"-s",
|
| 391 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 392 |
)
|
| 393 |
@option(
|
| 394 |
"--params",
|
|
|
|
| 429 |
stealthy_headers,
|
| 430 |
):
|
| 431 |
"""
|
| 432 |
+
Perform a PUT request and save the content to a file.
|
| 433 |
|
| 434 |
:param url: Target URL for the request.
|
| 435 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
|
|
| 464 |
|
| 465 |
|
| 466 |
@extract.command(
|
| 467 |
+
help=f"Perform a DELETE request and save the content to a file.\n\n{__OUTPUT_FILE_HELP__}"
|
| 468 |
)
|
| 469 |
@argument("url", required=True)
|
| 470 |
@argument("output_file", required=True)
|
|
|
|
| 482 |
@option(
|
| 483 |
"--css-selector",
|
| 484 |
"-s",
|
| 485 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 486 |
)
|
| 487 |
@option(
|
| 488 |
"--params",
|
|
|
|
| 521 |
stealthy_headers,
|
| 522 |
):
|
| 523 |
"""
|
| 524 |
+
Perform a DELETE request and save the content to a file.
|
| 525 |
|
| 526 |
:param url: Target URL for the request.
|
| 527 |
:param output_file: Output file path (.md for Markdown, .html for HTML).
|
|
|
|
| 587 |
@option(
|
| 588 |
"--css-selector",
|
| 589 |
"-s",
|
| 590 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 591 |
)
|
| 592 |
@option("--wait-selector", help="CSS selector to wait for before proceeding")
|
| 593 |
@option("--locale", default="en-US", help="Browser locale (default: en-US)")
|
|
|
|
| 736 |
@option(
|
| 737 |
"--css-selector",
|
| 738 |
"-s",
|
| 739 |
+
help="CSS selector to extract specific content from the page. It returns all matches.",
|
| 740 |
)
|
| 741 |
@option("--wait-selector", help="CSS selector to wait for before proceeding")
|
| 742 |
@option(
|