最近在使用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.
你怎么解决这个问题?
对于PyDrive,您需要创建并使用具有更高限制的独特OAuth客户端客户端ID。说明在这里:
https://pythonhosted.org/PyDrive/quickstart.html#authentication
但是,使用内置的Drive FUSE客户端与Drive进行交互可能更简单。要使用它,请使用以下代码段执行代码单元格:
from google.colab import drive
drive.mount('/content/drive')