OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Python API referencev12.0

Attachment

class optris_sdk.snapshot.Attachment

One file carried inside a snapshot or a recording.

The same type in every direction. A provider builds one -- Attachment('context.txt', b'layout=line4', mime='text/plain') -- Snapshot.attachments hands one back per file in a snapshot that was read, and optris_sdk.recording.RecordingFile.attachments does the same for a recording, which is also what optris_sdk.recording.RecordingFile.attach_files takes.

Bytes read back out of a file are fetched on first use of data and then kept, so listing what a snapshot or a recording carries costs nothing until something wants the contents. That fetch needs the file still open.

  • Attribute name — the file name as a reader should see it. Names need not be unique.
  • Attribute mime — the MIME type. None on the way in is written as application/octet-stream.
  • Attribute size — the uncompressed byte count.
  • Attribute sha256 — lowercase hex digest of the uncompressed bytes. None for an attachment that has not been through a file. Verified on a snapshot and not on a recording, and the difference is in the containers rather than here: a snapshot's attachments are deflated inside an otCa chunk and are checked as they are inflated, while an MKV attachment stream is stored verbatim, so there is no decode that could go wrong unnoticed and the value is the digest the file's own index recorded. '' from a recording is "the file does not say", never "it matched".
  • Attribute compress — whether to deflate the payload on the way in -- false for content that is already compressed, where it only costs time. None on the way out, because the file does not record it and guessing would be an invention. Ignored entirely on a recording, in both directions: an MKV attachment stream is stored verbatim.

Attachment — properties

data

The file's content, as bytes.

Attachment — methods

__repr__()