Googe驱动器api - 不支持地图导出(python)

时间:2016-07-23 00:46:34

标签: python google-drive-api

使用python api客户端我可以使用exportexport_media导出google文档,使用get_media导出非google doc资料。

保存在用户帐户中的地图无法移植。 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'

一起使用

1 个答案:

答案 0 :(得分:2)

您可以使用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我的地图确实支持导出到KMZ / KML,我认为理想情况下Google Drive API也是如此。您可以在issue tracker上提交功能请求。