在Google Colab中使用pydrive时发生ApiRequestError

2024-06-16 12:38:18 发布

您现在位置:Python中文网/ 问答频道 /正文

最近在使用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.

你怎么解决这个问题?在


Tags: installpipfromimportclientauthgoogledrive
1条回答
网友
1楼 · 发布于 2024-06-16 12:38:18

对于PyDrive,您需要创建和使用一个具有更高限制的独特的OAuth客户机客户机ID。说明如下:

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

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

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

Details here。在

相关问题 更多 >