PyDrive icon indicating copy to clipboard operation
PyDrive copied to clipboard

downloadURL missing for plain uploaded files

Open pete0877 opened this issue 8 years ago • 2 comments

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

pete0877 avatar Feb 10 '17 13:02 pete0877

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

RNabel avatar Mar 10 '17 22:03 RNabel

It happening to me also

mercarikaicheung avatar Dec 16 '17 02:12 mercarikaicheung