Basic client for Google Cloud Speech API.
Client(credentials=None, _http=None, _use_grpc=None)#
Client to bundle configuration needed for API requests.
- credentials (
Credentials) – (Optional) The OAuth2 Credentials to use for this client. If not passed (and if no
_httpobject is passed), falls back to the default inferred from the environment.
- _http (
Http) – (Optional) HTTP object to make requests. Can be any object that defines
request()with the same interface as
request(). If not passed, an
_httpobject is created that is bound to the
credentialsfor the current object. This parameter should be considered private, and could change in the future.
- _use_grpc (bool) – (Optional) Explicitly specifies whether
to use the gRPC transport (via GAX) or HTTP. If unset,
falls back to the
GOOGLE_CLOUD_DISABLE_GRPCenvironment variable. This parameter should be considered private, and could change in the future.
The scopes required for authenticating as an API consumer.
sample(content=None, source_uri=None, stream=None, encoding=None, sample_rate_hertz=None)#
Factory: construct Sample to use when making recognize requests.
- content (bytes) – (Optional) Bytes containing audio data.
- source_uri (str) – (Optional) URI that points to a file that contains
audio data bytes as specified in RecognitionConfig.
Currently, only Google Cloud Storage URIs are
supported, which must be specified in the following
- stream (file) – (Optional) File like object to stream.
- encoding (str) – encoding of audio data sent in all RecognitionAudio
messages, can be one of:
- sample_rate_hertz (int) – Sample rate in Hertz of the audio data sent in all requests. Valid values are: 8000-48000. For best results, set the sampling rate of the audio source to 16000 Hz. If that’s not possible, use the native sample rate of the audio source (instead of re-sampling).
Return type: Returns:
Helper for speech-related API calls.
- credentials (