data_updater_v2.data_clients.schemas
schemas.py — what a client is told, and the facts a client declares beside its endpoints.
Taken from nc-feeds schemas/providers/configs.py (the declarations its runner reads),
with the package’s own contracts left behind: ProviderConfig is ClientConfig here,
the floor is a plain datetime.date, and Window gains span_seconds for vendors
whose one call covers less than a day (Bitstamp: 1,000 one-minute bars). Everything else is
the nc-feeds text.
Two kinds of shape live here. ClientConfig is what a client is TOLD at construction: it
extends common-http’s client config, so every HTTP knob arrives inherited, and it adds only
the client’s own concerns. Walk and the shapes under it are what a CLIENT DECLARES beside
each common-http Endpoint: how the endpoint pages, how far one call may reach in time,
where its rows sit, what a call costs. The quotas themselves are common-rates’ Quota;
this file redeclares nothing a common package already says.
ClientConfig told: auth, quotas, account, batching, stopping, and all of HTTPBatching how a walk's independent work is groupedStopping when a walk may stop, and when it is debtPaging how one endpoint pagesWindow the legal bounded span of one call, and the vendor's floorWalk the facts beside one endpoint: rows, order, time, paging, window, cap, cost, absentClasses
Batching
Bases: BaseModel
How a walk’s independent work is grouped.
Concurrency itself is the inherited max_concurrency; these are the
checkpoint widths at each level, how many independent pages or windows are
submitted before the walk waits and reads what came back. None means the
inherited width. Dependent steps, a cursor chain or a response-driven
cascade, are sequential whatever is set here.
ClientConfig
Bases: HttpClientConfig
What a client is told.
Everything HTTP is inherited from common-http’s client config: base URL, default headers and query, retry, timeouts, concurrency, HTTP/2, TLS, proxy, decode. Only the client’s own concerns are added. The flow builds one from its settings; the client reads nothing on its own.
Paging
Bases: BaseModel
How one endpoint pages. Every parameter here names a declared common-http
Parameter of the endpoint; a path is where a value sits in the payload.
Stopping
Bases: BaseModel
When a walk may stop, and when it is debt.
Each proof is on by default and overridable. A caller’s hook is a per-call argument to the walk, never configuration.
Walk
Bases: BaseModel
The facts beside one common-http Endpoint, keyed by its name in the
client’s WALKS table. An endpoint with no Walk is one hit.
cost_of
cost_of(items: int = 1) -> floatThe quota weight of one call carrying items items.
Window
Bases: BaseModel
The legal bounded span of one call, and the vendor’s floor.
The walk always supplies both bounds and cascades on the response. There is no flag for an omitted bound meaning everything: a vendor that serves everything when a parameter is passed is a second endpoint declaration, not a flag here.
cap_for
cap_for(values: Mapping[str, object]) -> int | NoneThe day cap for one call’s values: the one picked by by, else span.
span_for
span_for(values: Mapping[str, object]) -> dt.timedelta | NoneThe legal span of one call for these values: seconds when declared, else days.