I tried submitting this to Google support but they referred me to stack overflow but there's an issue when running the insert function for the Google Drive API using the python library googleapiclient.
Python Broken API Function Call
When trying to insert a MediaFileUpload as per the instructions in
https://developers.google.com/drive/v2/reference/files/insert
How do I submit lines of code in a comment?
UPDATED:
http = httplib2.Http()
http = credentials.authorize(http)
service = build('drive', 'v2', http=http)
media_body = MediaFileUpload('test.csv', mimetype='application/vnd.ms-excel', resumable=True)
body = {
'title': 'test.csv',
'description': 'test description',
'mimeType': 'application/vnd.ms-excel'
}
file = service.files().insert(body=body,media_body=media_body).execute()
It doesn't actually work, you keep getting an error message saying a string or MediaFile type is required File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 692, in method raise TypeError('media_filename must be str or MediaUpload.')
Does anyone know why media_body can't be MediaFileUpload when the documentation clearly says use MediaFileUpload?