speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

Google Cloud backend errors are not properly caught

Open zenogantner opened this issue 7 years ago • 1 comments

  File "/usr/local/lib/python3.5/dist-packages/stt_measurement-0.0.1-py3.5.egg/stt_measurement/transcriber.py", line 136, in transcribe_wav
  File "/usr/local/lib/python3.5/dist-packages/stt_measurement-0.0.1-py3.5.egg/stt_measurement/transcriber.py", line 173, in _sr_call
  File "/usr/local/lib/python3.5/dist-packages/speech_recognition/__init__.py", line 955, in recognize_google_cloud
    speech_service = build("speech", "v1", credentials=api_credentials, cache_discovery=False)
  File "/usr/local/lib/python3.5/dist-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/googleapiclient/discovery.py", line 230, in build
    raise e
  File "/usr/local/lib/python3.5/dist-packages/googleapiclient/discovery.py", line 222, in build
    requested_url, discovery_http, cache_discovery, cache)
  File "/usr/local/lib/python3.5/dist-packages/googleapiclient/discovery.py", line 272, in _retrieve_discovery_doc
    raise HttpError(resp, content, uri=actual_url)
googleapiclient.errors.HttpError: <HttpError 500 when requesting https://www.googleapis.com/discovery/v1/apis/speech/v1/rest returned "Backend Error">

We need to catch googleapiclient.errors.HttpError and re-throw them as RequestError.

zenogantner avatar Jun 20 '18 10:06 zenogantner

Hello maintainers!
I’d like to contribute to issue #361 as part of Hacktoberfest 2025.
This looks like an interesting bug related to live audio stream handling — I’d love to investigate and test potential fixes.
Please assign this to me if it’s still open. 😊

Pranavi125 avatar Oct 29 '25 04:10 Pranavi125