Google Drive Api 'md5checksum' Does Not Work On Python
Solution 1:
From the Google Drives API V3:
md5Checksum - string - The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
So if your document does not contain binary data, there will not be an md5Checksum field in the metadata. The Google Drives API V2 explicitly said that it was not populated for Google Documents:
md5Checksum - string - An MD5 checksum for the content of this file. This field is only populated for files with content stored in Drive; it is not populated for Google Docs or shortcut files.
It is not obvious why they removed the reference to Google Documents in the V3 API. Either way it is clear that the md5Checksum field will not be populated for every file, so you should use something like:
iffi['title'] == "Test":
print('The name is: %s and md5 is: %s' % (fi['title'], fi.get('md5Checksum'))
This avoids throwing the exception and returns None
as expected if the field is not populated.
Post a Comment for "Google Drive Api 'md5checksum' Does Not Work On Python"