[英]How to solve “Daily Limit for Unauthenticated Use Exceeded" when getting list of all files using Google Drive API
I wanted to get list of all non-trashed files in my Google Drive and therefore modified the example provided by Google: https://developers.google.com/drive/api/v2/reference/files/list#examples我想获取我的 Google Drive 中所有非垃圾文件的列表,因此修改了 Google 提供的示例: https : //developers.google.com/drive/api/v2/reference/files/list#examples
The example looks like this:该示例如下所示:
result = []
page_token = None
while True:
try:
param = {}
param['q'] = 'trashed=false'
if page_token:
param['pageToken'] = page_token
files = service.files().list(**param).execute()
result.extend(files['files'])
page_token = files.get('nextPageToken')
However, this resulted in the error: "HTTpError 400 when requesting.... returned "Invalid Value"" in my console and when following the html path it resulted in "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup error."但是,这导致了错误:“请求时出现 HTTP 错误 400.... 在我的控制台中返回了“无效值””,当遵循 html 路径时,它会导致“超出未经身份验证使用的每日限制。继续使用需要注册错误。”
When the query is run without the "trashed=false" there is no issue and therefore the error of the daily limit exceeded seems to be wrong.当查询在没有“trashed=false”的情况下运行时,没有问题,因此超出每日限制的错误似乎是错误的。
I am not entirely sure why, but passing the arguments directly instead of using the dictionary "param" solved the issue!我不完全确定为什么,但是直接传递参数而不是使用字典“param”解决了这个问题!
Example:例子:
param = {}
if page_token:
param['pageToken'] = page_token
files = service.files().list(q='trashed=false', pageToken=page_token).execute()
result.extend(files['files'])
page_token = files.get('nextPageToken')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.