3
votes

I'm working with google app engine and trying to make a python app that stores shortcuts to files in drive

When I try to create a shortcut in Drive, following the code in the documentation.. the file created always has the mimetype 'application/octet-stream' even though i specify 'application/vnd.google-apps.drive-sdk'.

drive_service = build('drive', 'v2', http=http)

# Insert a shortcut

body = {
  'title': 'shortcut',
  'description': 'description',
  'mimetype': 'application/vnd.google-apps.drive-sdk',
}
file = drive_service.files().insert(body=body).execute()

Does anyone else have the same problem ?

1

1 Answers

4
votes

mimeType is case sensitive, with an uppercase T:

body = {
  'title': 'shortcut',
  'description': 'description',
  'mimeType': 'application/vnd.google-apps.drive-sdk',
}

Quoting from the files().insert() documentation:

"mimeType": "A String", # The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type.