简体   繁体   English

使用 Google Drive API 获取所有文件的列表时如何解决“超出未经身份验证使用的每日限制”

[英]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.

相关问题 使用Google Drive API和Python的错误403-超出了未经身份验证的使用的每日限制 - Error 403 using Google Drive API with Python - Daily Limit for Unauthenticated Use Exceeded 复制某些文件时,超出未经身份验证的使用的每日限制 - Daily Limit for Unauthenticated Use Exceeded when copy some files google-drive-sdk导出未经授权的每日限制 - google-drive-sdk export Daily Limit unauthenticated use 使用Google自定义搜索API时,“每日限制超出” - “daily limit exceeded” when using Google custom search API 不断收到错误消息“超出了未经身份验证的使用的每日限制。继续使用需要注册。” - Keep getting error "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." Google云端翻译API-“超出每日限制” - Google cloud translate API - “Daily Limit Exceeded” 如何在不使用结构的情况下解决这个问题? (超过时间限制) - How to solve this problem without using a strucure? (Getting Time Limit Exceeded) 如何使用google drive api获取google drive中所有文件的名称? - How to fetch name of all files in google drive using google drive api? 如何使用 python 驱动器 api 将 csv 文件上传到谷歌驱动器 - How to upload csv files to google drive using python drive api 如何查找 Google 服务帐户拥有的文件列表? (已超出用户的 Drive 存储配额) - How to find the list of files owned by Google service account? (The user's Drive storage quota has been exceeded)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM