Get the id_token, request the scopes profile and email
Then you can get profile info at https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=[accesstoken]
API Auth
Can download their file and do some gcloud command to get token
Or can create API KEY then attach to urls with ?key=[APIKEY]
Speech to Text
Credientials determined automatically if you set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the Google JSON file
import ioimport os# Imports the Google Cloud client libraryfrom google.cloud import speechfrom google.cloud.speech import enumsfrom google.cloud.speech import types# Instantiates a clientclient = speech.SpeechClient()# The name of the audio file to transcribefile_name ="./Endgame.mp3"# Loads the audio into memorywith io.open(file_name, 'rb')as audio_file: content = audio_file.read() audio = types.RecognitionAudio(content=content)config = types.RecognitionConfig( encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16, sample_rate_hertz=16000, language_code='en-US', enableWordTimeOffsets=True)# Detects speech in the audio fileresponse = client.LongRunningRecognize(config, audio)for result in response.results:print('Transcript: {}'.format(result.alternatives[0].transcript))
body = {
"input":{
"text":"Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."
},
"voice":{
"languageCode":"en-gb",
"name":"en-GB-Standard-A",
"ssmlGender":"FEMALE"
},
"audioConfig":{
"audioEncoding":"MP3"
}
}
url = https://texttospeech.googleapis.com/v1/text:synthesize?key=[API_KEY]