Skip to content

Commit

Permalink
Fixup: relocate options deprecation notice to after wild_mode opt…
Browse files Browse the repository at this point in the history
…ion has been removed from the keyword-argument dictionary.
  • Loading branch information
jayaddison committed Jul 26, 2024
1 parent cf59119 commit 5d8b41c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,15 @@ def scrape_me(url_path: str, **options: Any) -> AbstractScraper:
raise WebsiteNotImplementedError(host_name)
else:
options.pop("wild_mode")
if options:
_emit_options_deprecation_notice()
wild_scraper = SchemaScraperFactory.generate(url_path, **options)
if not wild_scraper.schema.data:
raise NoSchemaFoundInWildMode(url_path)
return wild_scraper

if options:
_emit_options_deprecation_notice()
return scraper(url_path, **options)


Expand All @@ -809,9 +813,6 @@ def scrape_html(

host_name = get_host_name(org_url) if org_url is not None else None

if options:
_emit_options_deprecation_notice()

scraper = None
if host_name:
with contextlib.suppress(KeyError):
Expand All @@ -822,13 +823,17 @@ def scrape_html(
raise WebsiteNotImplementedError(host_name)

options.pop("wild_mode")
if options:
_emit_options_deprecation_notice()
wild_scraper = SchemaScraperFactory.generate(url=org_url, html=html, **options)

if not wild_scraper.schema.data:
raise NoSchemaFoundInWildMode(org_url)

return wild_scraper

if options:
_emit_options_deprecation_notice()
return scraper(url=org_url, html=html, **options)


Expand Down

0 comments on commit 5d8b41c

Please sign in to comment.