Google Drive API 客户端(Python):files().insert() 的权限不足

Google Drive API Client (Python): Insufficient Permission for files().insert()(Google Drive API 客户端(Python):files().insert() 的权限不足)
本文介绍了Google Drive API 客户端(Python):files().insert() 的权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!


我正在尝试让一个简单的 Python Google Drive 上传器正常工作.我在开发者控制台中创建了一个项目,启用了 Drive API 并添加了一个 OAuth 2.0 客户端 ID(应用程序类型 Other).

I am trying to get a simple Python Google Drive uploader working. I've created a project in the developer console, enabled the Drive API and added an OAuth 2.0 client ID (application type Other).

我可以看到Google Drive的设置->管理应用中列出的应用程序,并且可以成功执行Google的Python Drive API客户端提供的许多操作.files ().insert () 但是失败了:

I can see the application listed in the Google Drive's Settings -> Manage Apps, and can successfully execute many operations provided by the Python Drive API client from Google. files ().insert () however fails with:

googleapiclient.errors.HttpError: <HttpError 403 when requesting returned "Insufficient Permission">


This is for an insert into a directory which I have made writable to everyone, as seen below:

credentials = get_credentials ()
http = credentials.authorize (httplib2.Http ())
service = ('drive', 'v2', http=http)


perms = service.permissions().list(fileId=PARENT_ID).execute()

print ("PERMISSIONS:")
for perm in perms["items"]:
    for p in perm:
        print (p, perm[p])


parent = {
    "isRoot": False,
    "kind": "drive#parentReference",
    "id": PARENT_ID

service.files ().insert (
    body = {"parents" : [parent]},
).execute ()


(u'withLink', True)
(u'kind', u'drive#permission')
(u'etag', u'"F-w0rsCIWtQP8RGyv_V1DlKfcRk/icwHkDdfUYuMzqZrUsVIyvu85K8"')
(u'role', u'writer')
(u'type', u'anyone')
(u'id', u'anyoneWithLink')
(u'selfLink', u'')


Can anyone point me to which permission I am missing, please?


文件: 插入 需要至少具有以下范围之一的授权

Files: insert requires authorization with at least one of the following scopes


Check which scope you are authenticating with.

这篇关于Google Drive API 客户端(Python):files().insert() 的权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



python arbitrarily incrementing an iterator inside a loop(python在循环内任意递增迭代器)
Joining a set of ordered-integer yielding Python iterators(加入一组产生 Python 迭代器的有序整数)
Iterating over dictionary items(), values(), keys() in Python 3(在 Python 3 中迭代字典 items()、values()、keys())
What is the Perl version of a Python iterator?(Python 迭代器的 Perl 版本是什么?)
How to create a generator/iterator with the Python C API?(如何使用 Python C API 创建生成器/迭代器?)
Python generator behaviour(Python 生成器行为)