Google Vision API来自IP地址的请求被阻止
问题描述:
我使用Google Vision OCR通过PHP语言从图像中获取文本。 当我用了很长时间。我得到以下错误:Google Vision API来自IP地址的请求被阻止
array(1) {
["error"]=>
array(4) {
["code"]=>
int(403)
["message"]=>
string(53) "Requests from IP address ..... are blocked."
["status"]=>
string(17) "PERMISSION_DENIED"
["details"]=>
array(1) {
[0]=>
array(2) {
["@type"]=>
string(35) "type.googleapis.com/google.rpc.Help"
["links"]=>
array(1) {
[0]=>
array(2) {
["description"]=>
string(32) "Google developer console API key"
["url"]=>
string(75) "https://console.developers.google.com/project/191619933224/apiui/credential"
}
}
}
}
}
}
请给我理由,以及如何解决它。 非常感谢。
答
检查您是否已授权Cloud API console中的API并配置了您的PHP客户端,如sample documentation中所述。
确保您在运行样本之前,下载与您的vision API项目关联的credentials.json
文件,并将GOOGLE_APPLICATION_CREDENTIALS
环境变量设置为凭证路径。
可能你已经超出了你的请求限制配额,并且ip不能再发送请求。您需要提高限制或更好地处理请求。 – Gntem
您是否检查过Google API API仪表板?它显示任何错误? – Tienkamp