Я использую Google Cloud Speech API версии 2 для проверки статуса длительно выполняемого задания распознавания.
Код: Выделить всё
from google.cloud.speech_v2 import SpeechClient
client_options_ = client_options.ClientOptions(
api_endpoint = "us-west1-speech.googleapis.com"
)
client = SpeechClient(client_options = client_options_)
ops_obj = { "name": "{{name-of-my-job}}" }
resp_obj = client.get_operation(ops_obj)
resp_metadata = resp_obj.metadata.value
print(resp_metadata)
Код: Выделить всё
b'\n\x0c\x08\xf0\x8a\xc7\xaf\x06\x10\xa0\xdf\xb3\xce\x03\x12\x0c\x08\x89\xac\xc7\xaf\x06\x10\xe0\xef...
Код: Выделить всё
resp_metadata.decode('utf-8')
Код: Выделить всё
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 3: invalid continuation byte
Источник: https://stackoverflow.com/questions/781 ... ch-api-use