ovok_sdk.resources.measurement_sender
Sends observation bundles: one reading as a transaction, several as batches.
- Stable unknown
- Release candidate not available
- Development since 0.2.0-dev.36+f12b151
Sends observation bundles: one reading as a transaction, several as batches.
MeasurementSender
MeasurementSender(send_batch: SendBatch, current_owner_key: Callable[[], str | None])Sends observation bundles for the account that owns them.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
send_batch | SendBatch | Posts one batch or transaction Bundle with an options keyword and returns the response. | |
current_owner_key | Callable[[], str | None] | Returns the key of the account signed in now. |
send_groups()
send_groups(
groups: list[list[BundleEntry]],
owner: str | None,
*,
options: RequestOptions | None = None,
) -> BundleSend readings: one as a transaction, several as batches, main Observations first.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
groups | list[list[BundleEntry]] | Each reading's entries, main Observation first. | |
owner | str | None | Key of the account the readings belong to. | |
options | RequestOptions | None | None | Per-request options; timeout overrides the client's. |
Returns
Bundle: The response Bundle.
Raises
OvokError: The server refused an Observation, or the account changed.
send_packed()
send_packed(
groups: list[list[BundleEntry]],
owner: str | None,
*,
options: RequestOptions | None = None,
) -> BundleSend readings packed into as few requests as fit, one request after another.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
groups | list[list[BundleEntry]] | Each reading's entries, main Observation first. | |
owner | str | None | Key of the account the readings belong to. | |
options | RequestOptions | None | None | Per-request options; timeout overrides the client's. |
Returns
Bundle: Onebatch-responseBundle with every request's entries.
Raises
OvokError: The server refused an Observation, or the account changed.
send()
send(
bundle: Bundle,
owner: str | None,
*,
options: RequestOptions | None = None,
) -> BundleSend one Bundle, split when it is too large or has many conditional entries.
A transaction the server refuses with 412, because its main Observation matched several saved copies, is sent again as batches.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
bundle | Bundle | The transaction or batch Bundle. | |
owner | str | None | Key of the account that must stay signed in. | |
options | RequestOptions | None | None | Per-request options; timeout overrides the client's. |
Returns
Bundle: The response Bundle.
Raises
OvokError: The server refused an Observation, or the account changed.
pack_observation_groups()
pack_observation_groups(
groups: list[list[BundleEntry]],
max_entries: float = inf,
) -> list[list[list[BundleEntry]]]Pack readings into as few requests as fit the size and entry limits.
Each reading stays whole; a reading too big for one request is a request by itself.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
groups | list[list[BundleEntry]] | Each reading's entries. | |
max_entries | float | inf | Most entries per request. |
Returns
list[list[list[BundleEntry]]]: The requests, each a list of readings.
Last updated on