Get Object#

You can retrieve a stored object given the object ID using the GetObject API call. The result of retrieving an object is a StoredObject structure.

Example#

This example demonstrates how to retrieve a stored object by specifying its object ID.

get_object.py

from soniox.speech_service import SpeechClient
from soniox.storage import get_object


# Do not forget to set your API key in the SONIOX_API_KEY environment variable.
def main():
    with SpeechClient() as client:
        object_id = "my_id_for_audio"

        # Get object.
        stored_object = get_object(object_id, client)

        # Print transcript tokens and text.
        transcript = stored_object.transcript
        print([token.text for token in transcript.tokens])
        print(transcript.text)


if __name__ == "__main__":
    main()

Run

python3 get_object.py

Output

['this', ',', 'my', 'friends', ',', 'is', 'the', 'air', 'jordan', 'six', 'in', 'the', "what's", 'being', 'labeled', 'currently', 'the', 'toro', 'colorway', '.', "it'll", 'be', 'interesting', 'to', 'see', 'what', 'nike', 'sneakers', 'actually', 'calls', 'them', '.']
This, my Friends, is the air Jordan 6 in the what's being labeled currently the toro colorway. It'll be interesting to see what Nike sneakers actually calls them.