返回

无法使用 API 'https://www.googleapis.com/drive/v3/files/<file_id>/export?mimeType=image%2Fjpeg' 从谷歌驱动器获取图像

发布时间:2022-05-20 21:37:14 363
# json

我的问题是使用'https://www.googleapis.com/drive/v3/files/<file_id>/export?mimeType=image%2Fjpeg'时我无法在谷歌驱动器上获取图像

在这里,我的代码:

from pydrive import auth, drive
import requests

gauth = auth.GoogleAuth()
scope = ["https://www.googleapis.com/auth/drive"]
gauth.credentials = auth.ServiceAccountCredentials.from_json_keyfile_name('my_json.json', scope)
drv = drive.GoogleDrive(gauth)
access_token = drv.auth.credentials.get_access_token().access_token
url = 'https://www.googleapis.com/drive/v3/files/' + file_id + '/export?mimeType=image%2Fjpeg'
res = requests.get(url, headers={'Authorization': 'Bearer ' + access_token})

响应错误(403):

{
 "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."
 }
}

我只是重聚了10-20次。此错误响应似乎是错误的。

如何修复上述代码以获得响应?

提前感谢您的帮助!

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
下一篇
ansible如何使用regex运行 2022-05-20 19:50:29