Reputation:
I want to upload a file to google drive and add a string to its description.
This is the code so far:
def upload_file(filename, filepath, mimetype):
file_metadata = {'name': filename}
media = MediaFileUpload(filepath, mimetype=mimetype)
file = drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute()
print('File ID: %s' % file.get('id'))
Upvotes: 0
Views: 196
Reputation: 201428
You want to add the description of file when the file is uploaded. If my understanding is correct, how about this modification?
file_metadata = {'name': filename}
file_metadata = {
'name': filename,
'description': 'sample description'
}
If I misunderstand your question, please tell me. I would like to modify my answer.
Upvotes: 1