错误400:消息:API密钥无效,请传递有效的API密钥。状态:无效的论点

时间:2020-03-05 08:27:45

标签: google-api raspberry-pi3

因此,当我尝试使用Google语音文字时,我卡住了。我基本上遵循此代码。我正在使用树莓派将flac文件发送到Google云。

#!/bin/bash
# parameter 1 : file name, contains flac encoded voice recording

echo Sending FLAC encoded Sound File to Google:
key=''
url='https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key='$key
curl -i -X POST -H "Content-Type: audio/x-flac; rate=16000" --data-binary @$1 $url
echo '..all done'

但是我一直得到这个结果

{
   "error": {
   "code": 400,
   "message": "API key not valid. Please pass a valid API key.",
   "status": "INVALID_ARGUMENT",
   "details": [
     {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
           {
        "description": "Google developers console",
        "url": "https://console.developers.google.com"
      }
    ]
  }
]

} } ..全部完成

任何人都可以帮助解决什么问题?

0 个答案:

没有答案
相关问题