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(transcript.text)
        print([token.text for token in transcript.tokens])


if __name__ == "__main__":
    main()

Run

python3 get_object.py

Output

This, my friends, is the Air Jordan 6 in 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', ' ', "what's", ' ', 'being', ' ', 'labeled', ' ', 'currently', ' ',
'the', ' ', 'Toro', ' ', 'colorway.', ' ', "It'll", ' ', 'be', ' ', 'interesting', ' ',
'to', ' ', 'see', ' ', 'what', ' ', 'Nike', ' ', 'Sneakers', ' ', 'actually', ' ',
'calls', ' ', 'them.']