4.2.2.3. Capture

class wsapiwrapper.consumer.capture.CaptureWrapper(baseurl: str, tokenstr: str = None)[source]

Wraps capture endpoints of the Consumer API.

get(capture_id: int)dict[source]

Get one capture by its ID.

Makes a GET request to the Capture endpoint.

Parameters

capture_id (int) – Capture ID to retrieve.

Returns

Capture dictionary returned by the API.

Return type

dict

get_list(serial: str, offset: int = 0, limit: int = None)list[source]

Get a list of captures for a tag ordered newest first.

The list can be paginated so that each call returns ‘limit’ captures.

Parameters
  • serial (str) – Base64 serial that identifies the tag to read captures from.

  • offset (int) – Start list at the nth capture for pagination.

  • limit (int) – Limit the list length for pagination.

Returns

A list of capture dictionaries.

Return type

list

get_samples(capture_id: int, offset: int = 0, limit: int = None)list[source]

Get a list of samples from a capture.

Makes a GET request to the CaptureSamples endpoint.

The list can be paginated so that each call returns ‘limit’ samples at an ‘offset’ from the first.

Parameters
  • capture_id (int) – Capture ID to retrieve.

  • offset (int) – Start list at the nth sample for pagination.

  • limit (int) – Limit the list length for pagination.

Returns

A list of samples.

Return type

list

post(circbufb64: str, serial: str, statusb64: str, timeintb64: str, vfmtb64: str)dict[source]

Create a new capture from parameters encoded by wscodec.

These data are included in URL parameters passed to wsfrontend when a tag is scanned.

Makes a POST request to the Capture endpoint, which unwraps the circular buffer and decodes samples.

Parameters
  • circbufb64 (str) – Circular buffer containing base64 encoded samples. Ouptut by wscodec.

  • serial (str) – Base64 serial identifying the tag the capture has originated from.

  • statusb64 (str) – Base64 encoded status information (e.g. battery level). Output by wscodec.

  • timeintb64 (str) – Base64 encoded time interval between samples. Output by wscodec.

  • vfmtb64 (str) – Tag version string. See wscodec.

Returns

Capture dictionary.

Return type

dict