Skip to content

Commit

Permalink
πŸš€ Add option to disable go to url
Browse files Browse the repository at this point in the history
  • Loading branch information
awtkns committed Aug 13, 2024
1 parent 98f496d commit 8a472c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions harambe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ async def run(
context: Optional[Context] = None,
setup: Optional[SetupType] = None,
harness: WebHarness = playwright_harness,
disable_goto_url: bool = False,
**harness_options: Unpack[HarnessOptions],
) -> "SDK":
"""
Expand All @@ -320,7 +319,6 @@ async def run(
:param context: additional context to pass to the scrapers
:param setup: setup function to run before the scraper
:param harness: the harness to use for the browser
:param disable_goto_url: whether to disable the initial goto url
:return none: everything should be saved to the database or file
"""
domain = getattr(scraper, "domain", None)
Expand All @@ -347,7 +345,7 @@ async def run(
if setup:
await setup(sdk)

if not disable_goto_url:
if not harness_options.get("disable_go_to_url", False):
await page.goto(url)
await scraper(sdk, url, context)

Expand Down
1 change: 1 addition & 0 deletions harambe/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ class HarnessOptions(TypedDict, total=False):
headers: Optional[dict[str, str]]
viewport: Optional[ViewportSize]
abort_unnecessary_requests: bool
disable_go_to_url: bool
on_start: Optional[Callback]
on_end: Optional[Callback]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "harambe-sdk"
version = "0.19.12"
version = "0.19.13"
description = "Data extraction SDK for Playwright πŸ’πŸŒ"
authors = ["awtkns <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 8a472c9

Please sign in to comment.