3

我正在关注 Google Drive SDK ( https://developers.google.com/drive/quickstart#set_up_the_sample ) 的快速启动页面的示例 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-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.

输入验证码后。这些步骤相当简单,所以我想知道示例代码是否已过时(尽管我没有看到其他人遇到此错误,所以它似乎可能与我的设置有关,但我不确定那会是什么)。谢谢你的帮助。

4

3 回答 3

3

要扩展 papahoolio 的答案:

您需要确保该服务已启用,但有一个问题:“Drive SDK”“Drive API”服务都有,只有后者(“Drive API”)可以工作。但是,前者有漂亮的 Drive 图标,如果你像我一样,你会看到它。

启用:

于 2013-01-09T08:31:51.480 回答
0

我在使用企业版 Google Drive 时遇到了这个问题。在非商业 Google Drive 上运行时,示例代码运行良好。oauth 被公司政策阻止。

于 2012-12-21T19:27:48.660 回答
0

在 Google API 控制台中,有两个与驱动开发相关的服务,SDK 和 API。确保 Drive API已开启

于 2012-10-19T14:00:03.077 回答