Skip to content

Documentation

Python SDK: Response: website response

HTTP client methods return a Response. Its status, body, headers, final_url, from_cache, duration_ms, and snapshot_uuid fields need no additional request.

Examples are fragments inside def run(ctx):. All SDK methods are synchronous; do not add await.

Obtaining the SDK object

response = ctx.http().get(ctx.param('catalog_url', 'https://example.com/catalog'))

Methods

ok

response.ok() -> bool

No arguments.

Result: bool.

Check that the HTTP status is between 200 and 299 and the response is not a detected CAPTCHA challenge. An HTTP 200 challenge page does not mean the requested data is available.

result = response.ok()

dom

response.dom() -> Dom

No arguments.

Result: Dom. An SDK object; use its methods instead of emitting it directly.

Parse the response body as HTML, using the final URL after redirects.

result = response.dom()

json

response.json() -> Any

No arguments.

Result: Any.

Parse the response body as JSON.

result = response.json()

header

response.header(name) -> str | None

Argument Type Required Purpose
name str Yes Field, header, file, credential, or metric name, depending on the method.

Result: str | None.

Get a response header without regard to the letter case of its name.

result = response.header('Content-Type')

Properties

Property Type
status int
body str
final_url str
headers dict[str, str | list[str]]
from_cache bool
duration_ms int
snapshot_uuid str | None

status is the final HTTP code; body is decoded text, headers preserve received values, final_url reflects redirects. from_cache identifies cache reuse, duration_ms is request duration in milliseconds, and snapshot_uuid identifies the available snapshot or is None. Missing headers return None; JSON parse errors are not replaced by an empty result.

Errors and execution context

All calls are synchronous. Invalid arguments or malformed source data can raise ValueError/TypeError; a platform refusal or unavailable service raises RuntimeError. Missing elements/values return None or an empty collection only where explicitly documented. Do not convert every exception into an empty successful result. External-service methods are unavailable in export transformations; see transformation limits and environment.