Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I create a shortcut in Drive it has the mimetype 'application/octet-stream' even though i specify ''application/vnd.google-apps.drive-sdk''

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 ?

like image 764
MayK Avatar asked Nov 28 '25 09:11

MayK


1 Answers

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.

like image 134
Martijn Pieters Avatar answered Nov 29 '25 23:11

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!