下载文件内容 PyDrive v3 版本

Download File Content PyDrive v3 Version

我正在尝试使用 PyDrive V3 版本从 Google Drive 下载文件。

  1. I am really confused about the functions get_media() and export() which are to download the files. What is the difference?

  2. The get_media() function works with excel files and not csv files whereas the export() function works with csv files and not excel files. What is the reason? I have tried changing the mimetype based on the file but that does not change the results.

好吧,我找到了答案:

https://developers.google.com/drive/v3/web/manage-downloads

根据文件的类型,用于下载文件的功能会有所不同。

Depending on the type of download you'd like to perform — a file, a Google Document, or a content link — you'll use one of the following URLs:

  • 下载文件 — files.get alt=媒体文件资源
  • 下载并导出 Google 文档 — files.export
  • Link 一个用户到一个文件 — webContentLink 来自文件资源

我有 excel 文件上传到 Google 驱动器,但没有更改,所以 get_media() 函数可以处理这些文件,而我有一些 csv 文件,这些文件使用 Google 工作表和导出功能与之配合使用。

虽然我不喜欢这种分离下载内容功能的方式。这真是令人费解。