2016-07-23 12 views
0

Mit dem Python API-Client kann ich google docs mit export oder export_media und Non-Google-doc-Material mit get_media exportieren.Googe Laufwerk api - keine Unterstützung für Kartenexport (Python)

Im Benutzerkonto gespeicherte Karten sind nicht abrufbar. export kehrt der Fehler

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

Ich gebe es keinen Sinn macht get_media zu verwenden, aber ich versuche trotzdem die oben genannten Fehler gegeben. Es gibt:

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

Es scheint get_media und export zu widersprechen, was das Objekt ist.

Ich schlage vor, dass export mit mimeType='application/vnd.google-earth.kmz'

+0

Haben Sie versucht, die 'webContentLink' mit der Datei zu erhalten (sieht wie folgt aus https://docs.google.com/a/google.com/uc?id=FILE_ID&export=download)? –

+0

Danke @ Mr.Rebot, es scheint, dass wbContentLink nur für [binäre Inhalte] verfügbar ist (https://developers.google.com/drive/v3/reference/files#resource). Ich denke, die Methode "get_media" ist dafür ein Wrapper. – hippo30

Antwort

1

arbeiten sollten Sie Drive.About.get können die Exportformate zur Verfügung für jeden Google MIME-Typ ermitteln:

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" 
    ] 
} 
} 

Wie Sie sehen können, gibt es noch keine Exportformate definiert für application/vnd.google-apps.map. Da Google My Maps das Exportieren nach KMZ/KML unterstützt, denke ich im Idealfall auch an die Google Drive API. Sie können eine Feature-Anforderung unter issue tracker ablegen.

+0

Danke Eric. [Problem 4693] (https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=4693) – hippo30