Skip to content

data_updater_v2.data_clients.results

results.py — what a walk hands back: the payload fetch, with every nuance.

Taken from nc-feeds schemas/providers/results.py — RawResponse and the secret-free display helpers it uses, plus FetchError — with the package’s own contracts left behind (Time -> the plain values of times.py) and the normalizer layer’s FetchResult not taken: rows go from here straight to the flows that land them.

RawResponse follows the foundation law: common-http’s HttpResult is held by pointer and never copied. The request as built, the response and its headers, the execution report with the real exception, the failure reason and the retry trail all live there and surface here as derived properties, never as fields. Nothing here renders a URL query, a header or a payload, at any display tier.

str() one honest line
describe() the trail: every call, the failed one expanded, the nuances
analyze() the cause and the move
info the surface, reflected so it never drifts
repr() pointers only

Classes

FetchError

Bases: RuntimeError

A fetch that failed without raising, surfaced as an exception on request.

result is the RawResponse that failed; the message is its error_description, which never renders a secret.

RawResponse

The payload fetch: what the wire gave for one ask, and how.

One RawResponse covers the whole walk of one declared endpoint for one ask, whether that took one call or forty. calls keeps every common-http result by pointer, in execution order; rows are the raw lines the walk lifted at the declared rows path, in order, untouched by any normalizer.

ok is the runner’s verdict on step 1 and is stored, because only the runner knows what a vendor’s status meant: a 404 that means absence ends an ok walk with no rows. A failed response always names its cause: a call that did not come back ok, or a fault.

fault is one secret-free sentence for a failure on OUR side after the wire answered: the rows path missing, an error body under a 200, a page that repeated, the call ceiling reached. A fault is never set beside an ok verdict.

The nuances are tri-state wherever the vendor can be silent. complete False means the vendor’s cap was hit and the ask exceeds one call, True means under the cap, None means no cap is known. more is the vendor’s own word on whether pages follow. A fetch may clip; it may never lie.

dropped names every row a client’s own processing took out of rows (a repeat of one payout, a second bar for one day, a vendor’s no-print marker), each as {"why": ..., "row": ...}, so nothing leaves silently; the gap methods report them.

analyze

analyze() -> str

The cause, and the move.

describe

describe() -> str

The trail: the route, every call, the failed one expanded, the nuances.

unwrap

unwrap() -> tuple[Any, ...]

The rows, or the original exception re-raised, or FetchError.