Skip to content

Reading captures

client.list_captures()

Returns every capture your key can read, as a list[volumes.Capture]. Pages are followed automatically until the list is complete.

captures = client.list_captures()
for capture in captures:
    print(capture.capture_id)  # e.g. "capture_demo_001"

client.iter_captures()

The lazy variant: an iterator that requests one page at a time, only as you consume it. Use it when you have many captures or may stop early.

for capture in client.iter_captures():
    if capture.capture_id == "capture_demo_042":
        break  # later pages are never requested

Both methods accept an optional page_size=: captures per request, an integer from 1 to 1000 (the API's own range; its default is 100). It affects how many requests are made, not what is returned.

client.get_frame_sync(capture_id)

Returns a volumes.FrameSync:

  • .content: the file exactly as received, as bytes
  • .text: the same, decoded as UTF-8, as a string
  • .rows: the same data as a list[dict[str, str]], parsed with csv.DictReader (one dict per data row, keyed by the header row)
frame_sync = client.get_frame_sync("capture_demo_001")

print(frame_sync.content)
# b'camera_id,frame\ncam_a,0\ncam_b,2\n'

print(frame_sync.text)
# camera_id,frame
# cam_a,0
# cam_b,2

print(frame_sync.rows)
# [{'camera_id': 'cam_a', 'frame': '0'}, {'camera_id': 'cam_b', 'frame': '2'}]

columns = list(frame_sync.rows[0]) if frame_sync.rows else []
# ['camera_id', 'frame']

The header is camera_id,frame today. The SDK neither defines nor validates the columns: they can change over time, so read the column names from the data. To load the table elsewhere, pass the bytes or the text along, for example pandas.read_csv(io.BytesIO(frame_sync.content)); to keep the file, write .content to disk unchanged.

Every key and every value in .rows is a string, including for rows that do not match the header:

  • a row with fewer cells than the header gets "" for the missing ones;
  • cells beyond the header are left out of .rows (they are still in .text);
  • if two columns have the same name, the later one wins.

Nothing is decoded or parsed until you ask: .text is decoded the first time it is read, .rows is parsed the first time it is read, and .content is always available. If the bytes are not valid UTF-8, reading .text or .rows raises volumes.InvalidResponseError; if the text is not parseable as CSV at all, reading .rows does.

client.get_scene_summary(capture_id)

Returns the scene summary as a volumes.SceneSummary, which is a dict: the parsed JSON object, unchanged. Use it like any other dictionary. In addition it has .content, the JSON exactly as received, as bytes.

summary = client.get_scene_summary("capture_demo_001")
print(summary.get("schema_version"))
print(isinstance(summary, dict))  # True
print(summary.content)  # b'{"schema_version": 3, ...}'

The SDK does not define or validate the fields. The summary carries its own schema_version; check it if your code depends on a particular layout. To keep the file, write .content to disk unchanged; it stays as received even if you modify the dictionary.