I want to implement the Google Cloud speech to text using a service account. What i have try is i have set the environment variable to that json and send the post request to this url 'https://speech.googleapis.com/v1/speech:longrunningrecognize'.
Code: req = requests.post(url, data={ "audio":{ "content":enc }, "config":{ "audioChannelCount":2, "enableSeparateRecognitionPerChannel":True, "enableWordTimeOffsets":True, "diarizationConfig":{ "enableSpeakerDiarization": True, "minSpeakerCount": 1, "maxSpeakerCount": 2 },
}}) Error: 403 { "error": { "code": 403, "message": "The request is missing a valid API key.", "status": "PERMISSION_DENIED" } }
Authorization: Bearer [TOKEN]
header. Just setting the environment variable does not do this. Tip: Format your question so that people can read your code and error messages. In this article look at the code for listing instances. Very similar to what you need to do for your POST request. jhanley.com/… – John Hanley