google drive sdk快速启动python示例错误
下面是googledrivesdk()的快速启动页面的示例python代码,并得到了错误信息google drive sdk快速启动python示例错误,python,google-drive-api,Python,Google Drive Api,下面是googledrivesdk()的快速启动页面的示例python代码,并得到了错误信息 Traceback (most recent call last): File "quickstart.py", line 45, in <module> file = drive_service.files().insert(body=body, media_body=media_body).execute() File "build/bdist.macosx-10.7-i
Traceback (most recent call last):
File "quickstart.py", line 45, in <module>
file = drive_service.files().insert(body=body, media_body=media_body).execute()
File "build/bdist.macosx-10.7-intel/egg/oauth2client/util.py", line 120, in positional_wrapper
File "build/bdist.macosx-10.7-intel/egg/apiclient/http.py", line 656, in execute
File "build/bdist.macosx-10.7-intel/egg/oauth2client/util.py", line 120, in positional_wrapper
File "build/bdist.macosx-10.7-intel/egg/apiclient/http.py", line 733, in next_chunk
apiclient.errors.ResumableUploadError: Failed to retrieve starting URI.
回溯(最近一次呼叫最后一次):
文件“quickstart.py”,第45行,在
file=drive\u service.files().insert(body=body,media\u body=media\u body.execute())
文件“build/bdist.macosx-10.7-intel/egg/oauth2client/util.py”,第120行,在位置包装器中
文件“build/bdist.macosx-10.7-intel/egg/apiclient/http.py”,第656行,执行
文件“build/bdist.macosx-10.7-intel/egg/oauth2client/util.py”,第120行,在位置包装器中
文件“build/bdist.macosx-10.7-intel/egg/apiclient/http.py”,第733行,在下一块中
apiclient.errors.ResumableUploadError:检索开始URI失败。
输入验证码后。这些步骤相当简单,所以我想知道示例代码是否过时(虽然我没有看到其他人遇到这个错误,所以看起来可能与我的设置有关,但我不确定会是什么)。感谢您的帮助。在Google API控制台中,有两个与驱动器开发相关的服务,SDK和API。确保驱动器API处于打开状态我在公司版的Google Drive中遇到了这个问题。在运行非商业的googledrive时,示例代码运行良好。oauth正受到公司政策的阻碍 进一步阐述帕帕胡里奥的答案: 您需要确保服务已启用,但有一个问题:既有“驱动SDK”又有“驱动API”服务,只有后者(“驱动API”)可以工作。然而,前者有一个漂亮的驱动器图标,如果你像我一样,你可以想象它 要启用:
- 去
- 单击左侧菜单上的服务
- 启用“驱动器API”(不是驱动器SDK,但如果需要也可以启用)