API Reference#
Public package interface for souppot HTML fetching helpers.
- souppot.cold_soup(url, check_errors=False)#
Fetch a URL with
requestsand parse HTML responses.- Parameters:
- Return type:
- Returns:
BeautifulSoupfor200responses with atext/htmlcontent type, the rawrequests.Responsefor other200responses, andNonefor missing URLs or non-200responses.- Raises:
requests.HTTPError – If
check_errorsis true and the response status is an HTTP error.
- souppot.hot_pot(url, dest, referer=None, timeout_ms=60000)#
Download a URL with Playwright’s request context and save it to disk.
- Parameters:
- Return type:
- Returns:
The destination path as a
Path.- Raises:
ValueError – If
urlis missing.playwright.sync_api.Error – If Playwright cannot complete the request.
- souppot.hot_soup(url, wait_seconds=3, wait_selector=None)#
Render a URL with Playwright Chromium and parse the final DOM.
- Parameters:
url (
str|None) – URL to render.Noneand blank strings are treated as missing.wait_seconds (
float) – Seconds to sleep afterdomcontentloadedwhen nowait_selectoris provided. When waiting for a selector, this is converted to the selector timeout with a minimum of 1000 ms.wait_selector (
str|None) – Optional CSS selector to wait for before parsing. If the selector times out, the currently rendered DOM is parsed anyway.
- Return type:
- Returns:
BeautifulSoupfor the rendered page, orNonefor missing URLs or Playwright errors.