PyDrive
PyDrive copied to clipboard
downloadURL missing for plain uploaded files
Seems PyDrive relies on the downloadUrl meta property on files but that property has been removed in Google Drive API v3.
Doing .GetContentFile() raises "pydrive.files.FileNotDownloadableError: No downloadLink/exportLinks for mimetype found in metadata"
However, the file metadata does come with webContentLink property which seems to work the same way at least for plain uploaded drive files.
I was able to get around the issue by doing:
file_obj.FetchMetadata(fetch_all=True)
file_obj.metadata['downloadUrl'] = file_obj.metadata.get('webContentLink')
file_obj.GetContentFile('/tmp/test.csv')
..but obviously that's a hack.
Any guidance on cleaner way to solve this?
Thanks Pete
Hi Pete! Thank you for raising this here. I had a look into the problem and can confirm that standard files have the downloadURL present when downloading. I do, however, remember running into this problem at some point.
Could you supply the steps to reproduce this issue (incl. the file type)?
Thank you for providing the workaround you already found!
Finally, PyDrive is still using API v2 (unfortunately), so it may make sense to handle this kind of problem only when the transition to v3 has been finished.
Cheers, Robin
It happening to me also