【问题标题】:ApiRequestError when using pydrive in Google Colab在 Google Colab 中使用 pydrive 时出现 ApiRequestError
【发布时间】:2019-04-07 09:05:50
【问题描述】:

最近在像这样使用 Google Collab 的 pydrive 时

!pip install -U -q PyDrive
import os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials

# 1. Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)

我输入了代码,但之后我在尝试创建文件时开始收到 ApiRequestError。在回复中我看到Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

你如何解决这个问题?

【问题讨论】:

    标签: python google-colaboratory pydrive


    【解决方案1】:

    对于 PyDrive,您需要创建和使用具有更高限制的不同 OAuth 客户端 ID。说明在这里:

    https://pythonhosted.org/PyDrive/quickstart.html#authentication

    但是,使用内置 Drive FUSE 客户端与 Drive 交互可能更简单。要使用它,请使用以下 sn-p 执行代码单元:

    from google.colab import drive
    drive.mount('/content/drive')
    

    Details here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-24
      • 2021-04-21
      • 2020-10-02
      • 2018-10-20
      • 2021-10-16
      • 1970-01-01
      • 2021-01-20
      相关资源
      最近更新 更多