I want to get many metadata from each file (title, mimetype, size, date last modified, ...) in just one call.
I followed this example in documentation.
file1 = drive.CreateFile({'id': '<some file ID here>'})
print('title: %s, mimeType: %s' % (file1['title'], file1['mimeType']))
#### THE ABOVE CODE WORKS PERFECTLY
#### BUT CODE BELOW FAILS:
# (1) Fetches all basic metadata fields, including file size, last modified etc.
file1.FetchMetadata()
# (2) Fetches all metadata available.
file1.FetchMetadata(fetch_all=True)
# (3) Fetches the 'permissions' metadata field.
file1.FetchMetadata(fields='permissions')
# (4) You can update a list of specific fields like this:
file1.FetchMetadata(fields='permissions,labels,mimeType')
But in fact, none of the above FetchMetadata() example calls is working for me (under Windows 7, Python 3.8).
1, 3 & 4 return NoneType.
And the example 2, FetchMetadata(fetch_all=True), raises this error:
File "c:\python38\lib\site-packages\pydrive2\auth.py", line 84, in _decorated
return decoratee(self, *args, **kwargs)
File "c:\python38\lib\site-packages\pydrive2\files.py", line 467, in FetchMetadata
raise ApiRequestError(error)
pydrive2.files.ApiRequestError: <HttpError 400 when requesting https://www.googleapis.com/drive/v2/files/1ckwZ4cwqDdjdcyB_GDvNc-T8zD4qrpKmIy2lTMQdfSU?fields=alternateLink%2CappDataContents%2CcanComment%2CcanReadRevisions%2Ccapabilitiescopyable%2CcreatedDate%2CdefaultOpenWithLink%2Cdescription%2CdownloadUrl%2Ceditable%2CembedLink%2Cetag%2CexplicitlyTrashed%2CexportLinks%2CfileExtension%2CfileSize%2CfolderColorRgb%2CfullFileExtension%2ChasAugmentedPermissions%2CheadRevisionId%2CiconLink%2Cid%2CimageMediaMetadata%2CindexableText%2CisAppAuthorized%2Ckind%2Clabels%2ClastModifyingUser%2ClastModifyingUserName%2ClastViewedByMeDate%2CmarkedViewedByMeDate%2Cmd5Checksum%2CmimeType%2CmodifiedByMeDate%2CmodifiedDate%2CopenWithLinks%2CoriginalFilename%2CownedByMe%2CownerNames%2Cowners%2Cparents%2Cpermissions%2Cproperties%2CquotaBytesUsed%2CselfLink%2Cshareable%2Cshared%2CsharedWithMeDate%2CsharingUser%2Cspaces%2CteamDriveId%2Cthumbnail%2CthumbnailLink%2Ctitle%2CtrashedDate%2CtrashingUseruserPermission%2Cversion%2CvideoMediaMetadata%2CwebContentLink%2CwebViewLink%2CwritersCanShare&supportsAllDrives=true&alt=json returned "Invalid field selection capabilitiescopyable". Details: "Invalid field selection capabilitiescopyable">
... and if I check that url in a browser, it is a json reply which suggests PyDrive is trying a non authenticated connection??
But of course, I have authenticated because my previous file1['title'] and file1['mimeType'] calls worked perfectly.
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
I wonder if this is related to #91
But in my case, I am NOT trying to update metadata.
I just want to read them.
I want to get many metadata from each file (title, mimetype, size, date last modified, ...) in just one call.
I followed this example in documentation.
But in fact, none of the above
FetchMetadata()example calls is working for me (under Windows 7, Python 3.8).1, 3 & 4 return
NoneType.And the example 2,
FetchMetadata(fetch_all=True), raises this error:... and if I check that url in a browser, it is a json reply which suggests PyDrive is trying a non authenticated connection??
But of course, I have authenticated because my previous
file1['title']andfile1['mimeType']calls worked perfectly.I wonder if this is related to #91
But in my case, I am NOT trying to update metadata.
I just want to read them.