gpt4 book ai didi

google-drive-api - 按名称查询 Google Drive API 返回无效

转载 作者:行者123 更新时间:2023-12-04 04:54:52 24 4
gpt4 key购买 nike

  • 根据 Google Drive 文档,要按名称查询文件,您可以使用:q="name = 'file name'"。

    https://developers.google.com/drive/v3/web/search-parameters
  • 当我尝试在此处按名称搜索时:https://developers.google.com/drive/v2/reference/files/list#try-it

    将“q”字段设置为“name = 'file_name'”。

    “参数‘q’的值无效。”被退回。
  • 当我尝试在 Python 中执行命令时会发生同样的事情:\
    service.files().list(q="name = 'file_name'").execute()
  • 其他命令如 q="trashed=false"工作正常。不知道为什么“名称”查询没有。
  • 最佳答案

    您遇到的问题是您正在尝试使用专门为 Drive v3 API 定义的搜索参数。与 Drive v2 API .

    使用 Drive v2 API 时, 文件名在 'title' 下,所以有效的查询是:

    标题 = '测试文档'

    而在 Drive v3 API , 文件名在 'name' 下:

    名称 = '测试文档'

    关于google-drive-api - 按名称查询 Google Drive API 返回无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34735220/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com