python - Google Drive api - 不支持 map 导出(python)

标签 python google-drive-api

使用 python api 客户端,我可以使用 export 导出谷歌文档或export_media和非 Google 文档 Material get_media .

用户帐户中保存的 map 无法导出。 export返回错误

HttpError: <HttpError 403 ... returned "Export only supports Google Docs.">

我承认使用get_media没有任何意义。但鉴于上述错误,我无论如何都会尝试。它返回:

HttpError: <HttpError 403 ... returned "Only files with binary content can be downloaded. Use Export with Google Docs files.">

看来get_mediaexport不同意这个对象是什么。

我建议export应该与 mimeType='application/vnd.google-earth.kmz' 一起使用

最佳答案

您可以使用 Drive.About.get 确定每种 Google MIME 类型可用的导出格式:

GET https://www.googleapis.com/drive/v3/about?fields=exportFormats&key={YOUR_API_KEY}

{
 "exportFormats": {
  "application/vnd.google-apps.form": [
   "application/zip"
  ],
  "application/vnd.google-apps.document": [
   "application/rtf",
   "application/vnd.oasis.opendocument.text",
   "text/html",
   "application/pdf",
   "application/zip",
   "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
   "text/plain"
  ],
  "application/vnd.google-apps.drawing": [
   "image/svg+xml",
   "image/png",
   "application/pdf",
   "image/jpeg"
  ],
  "application/vnd.google-apps.spreadsheet": [
   "text/csv",
   "application/x-vnd.oasis.opendocument.spreadsheet",
   "application/zip",
   "application/pdf",
   "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  ],
  "application/vnd.google-apps.script": [
   "application/vnd.google-apps.script+json"
  ],
  "application/vnd.google-apps.presentation": [
   "application/vnd.openxmlformats-officedocument.presentationml.presentation",
   "application/pdf",
   "text/plain"
  ]
 }
}

如您所见,目前没有为 application/vnd.google-apps.map 定义导出格式。鉴于 Google 我的 map 确实支持导出到 KMZ/KML,我认为理想情况下 Google Drive API 也可以。您可以在 issue tracker 上提交功能请求.

关于python - Google Drive api - 不支持 map 导出(python),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38537063/

相关文章:

Google Drive API V3 如何正确转义查询参数?

java - 如何在 root 中创建文件夹并在 Android 中的 Google Drive REST API v3 中获取其 ID

google-apps-script - 谷歌脚本 openById : You do not have permission to perform that action

python - 反转数据框中给定日期的时间

Python 值错误 : Pool not running in Async Multiprocessing

python - 使用 Python 从 MySQL 检索整数以执行数学函数

python - Python 中的 Cmd 日历

python - 如何从他的 ManyToMany 关系中选择包含某些 child 的 parent ?

python - 我们可以在使用 Google Drive API v2 时设置 urlfetch 截止日期吗?

google-apps-script - 如何以编程方式获取谷歌驱动器文件的文件(视频)持续时间?