简体   繁体   中英

Get size of files with Google Drive API v3

I'm extracting some data from the drive 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回应

Drive API documentation here .

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM