Google Drive API 403错误来自wget/curl,但不是来自浏览器



我正在尝试使用wget或curl从Google Drive下载一个大文件。我已经设置了一个驱动器API密钥来绕过大文件警告和需要身份验证。

将URL放入浏览器中可以立即下载(无需登录我的Google帐户)。但是当尝试用wget下载时,我得到一个403 Forbidden错误。尝试使用curl下载时会出现以下提示:

{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}

API密钥没有应用限制。为什么会发生这种情况,我该如何解决?

编辑,原调用:

curl https://www.googleapis.com/drive/v3/files/FileID?alt=media&key=APIKey --output out

感谢@Hassan。复制cURL成功了

显然缺少的是在调用curl时给URL加上引号。

编辑,新调用:

curl 'https://www.googleapis.com/drive/v3/files/FileID?alt=media&key=APIKey' --output out

最新更新