1ap / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

MIME type is not optional for Google Drive upload #310

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
On Google Drive API page it is said that MIME type is not necessary when 
uploading files - https://developers.google.com/drive/v2/reference/files/insert 
(Request body chapter). But an attempt to upload file using without MIME type 
using code from Getting Started example fails - 
https://developers.google.com/drive/quickstart-python

What steps will reproduce the problem?
1. Get example from https://developers.google.com/drive/quickstart-python
2. Remove mimetype='text/plain' argument from MediaFileUpload
3. Remove body=body argument from drive_service.files().insert() call

What is the expected output? What do you see instead?
Traceback (most recent call last):
  File "drive.py", line 295, in <module>
    file = drive_service.files().insert(media_body=media_body).execute()
  File "C:\discovery\disk\google/.locally/client-1.2\oauth2client\util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\discovery\disk\google/.locally/client-1.2\apiclient\http.py", line 688, in execute
    _, body = self.next_chunk(http=http, num_retries=num_retries)
  File "C:\discovery\disk\google/.locally/client-1.2\oauth2client\util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\discovery\disk\google/.locally/client-1.2\apiclient\http.py", line 808, in next_chunk
    raise ResumableUploadError(resp, content)
apiclient.errors.ResumableUploadError: <HttpError 400 "Media type 'None' is not 
supported. Valid media types: [*/*]">

What version of the product are you using? On what operating system?
google-api-python-client-1.2.zip
httplib2-0.8.zip

Please provide any additional information below.

Original issue reported on code.google.com by techtonik@gmail.com on 24 Oct 2013 at 11:59