简体   繁体   English

使用Google Drive API v3获取文件的大小

[英]Get size of files with Google Drive API v3

I'm extracting some data from the drive API: 我正在从驱动器API中提取一些数据:

response = service.files().list(q=q_parameter, spaces='drive', fields='nextPageToken, files(id, name,mimeType, webViewLink, owners, capabilities, createdTime, modifiedTime, size)', pageToken=page_token).execute()

I'm saving the response in a JSON file, but the size is not being saved... 我将响应保存在JSON文件中,但是没有保存大小...

JSON回应

Drive API documentation here . 在此处驱动API文档。

Any ideas? 有任何想法吗? Thanks. 谢谢。

Use fields * and it will download all of the metadata. 使用字段*,它将下载所有元数据。 If you hadent set up the limitation fields correctly the data would have returned null 如果您正确设置了限制字段,则数据将返回null

response = service.files().list(q=q_parameter, spaces='drive', fields='*', pageToken=page_token).execute()

I have found the problem! 我发现了问题! Everything works fine. 一切正常。 The native drive files don't take up space. 本机驱动器文件不占用空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取 Google Drive 视频的直接链接(Google Drive API v3) - How do I get the direct link for a Google Drive video (Google Drive API v3) Google Drive API v3 Python files()。list()中缺少某些文件 - Certain files missing in Google Drive API v3 Python files().list() Google API Drive V3 检索使用的驱动器存储空间 - Google API Drive V3 retrieving drive storage space used 如何使用 Python 将文件插入/上传到 Google Drive API v3 中的特定文件夹 - How can I insert/upload files to a specific folder in Google Drive API v3 using Python 无法与共享驱动器和文件交互 | Python 谷歌驱动器 API v3 - Cannot Interact with Shared Drives & Files | Python Google Drive API v3 Google Drive API v3:service.files().list 不返回所有文件夹 - Google Drive API v3: service.files().list not returning all folders 尝试从Google Drive Api v3获取文件列表时出现编码错误 - Encoding error when trying to obtain list of files from Google Drive Api v3 Google Drive API v3将Google电子表格下载为Excel - Google Drive API v3 download google spreadsheet as Excel Google Drive API v3 更改文件权限并获取可公开共享的链接 (Python) - Google Drive API v3 Change File Permissions and Get Publicly Shareable Link (Python) 如何在Google Drive API v3中获取文件的“lastModified”? - How can I get file's 'lastModified' in Google Drive API v3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM