API referenceovok_sdk.resources

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

NameTypeDefaultDescription
send_batchSendBatchPosts one batch or transaction Bundle with an options keyword and returns the response.
current_owner_keyCallable[[], 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,
) -> Bundle

Send readings: one as a transaction, several as batches, main Observations first.

Parameters

NameTypeDefaultDescription
groupslist[list[BundleEntry]]Each reading's entries, main Observation first.
ownerstr | NoneKey of the account the readings belong to.
optionsRequestOptions | NoneNonePer-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,
) -> Bundle

Send readings packed into as few requests as fit, one request after another.

Parameters

NameTypeDefaultDescription
groupslist[list[BundleEntry]]Each reading's entries, main Observation first.
ownerstr | NoneKey of the account the readings belong to.
optionsRequestOptions | NoneNonePer-request options; timeout overrides the client's.

Returns

  • Bundle: One batch-response Bundle 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,
) -> Bundle

Send 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

NameTypeDefaultDescription
bundleBundleThe transaction or batch Bundle.
ownerstr | NoneKey of the account that must stay signed in.
optionsRequestOptions | NoneNonePer-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

NameTypeDefaultDescription
groupslist[list[BundleEntry]]Each reading's entries.
max_entriesfloatinfMost entries per request.

Returns

  • list[list[list[BundleEntry]]]: The requests, each a list of readings.

Last updated on

On this page