问题描述
我正在尝试使用 python 将文件上传到谷歌驱动器.我从此处显示的快速入门开始:https://developers.google.com/drive/api/v3/quickstart/python我创建了 oAuth 2 客户端 ID 并将凭证 json 文件下载到我的项目文件夹中.但是,当我尝试运行代码时,当它打开浏览器以确认我收到以下错误时:
I am trying to upload a file using python to google drive.I started with the quick start shown here:https://developers.google.com/drive/api/v3/quickstart/pythonIve created the oAuth 2 client id and downloaded the credentials json file to my project folder.However when I try to run the code, when it opens the browser to confirm I receive the following error:
Error: restricted_client
Unregistered scope(s) in the request: https://www.googleapis.com/auth/drive
Request Details
That’s all we know.
我试过改变范围
SCOPES = 'https://www.googleapis.com/auth/drive.metadata.readonly'
到
SCOPES = 'https://www.googleapis.com/auth/drive'
但是我得到了同样的错误我也尝试过制作新的凭据和客户端ID,仍然得到同样的错误
however I get the same errorI have also tried making a new credential and client id, still get the same error
谁能指出我做错了什么?
can anyone please point out what I am doing wrong?
推荐答案
更新时间:18:18 UTC
Update: at 18:18 UTC
似乎这是谷歌端的一个问题,现在似乎又可以工作了.我启动我的 python 代码,然后打开一个浏览器窗口,要求我登录.我可以登录并接收消息:
Seems that it was an issue on googles end and now seems to be working again. I launch my python code and a browser window opens asking me to log in. I can log in and receive the message:
The authentication flow has completed.
希望其他人也能正常工作
Hope everyone else is able to get theirs working as well
这篇关于错误:restricted_client 使用 google drive api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!