gpt4 book ai didi

python - 当我在云端硬盘中创建快捷方式时,它的 mimetype 为 'application/octet-stream',即使我指定了 '' application/vnd.google-apps.drive-sdk''

转载 作者:太空宇宙 更新时间:2023-11-03 15:12:30 25 4
gpt4 key购买 nike

我正在使用 google app engine 并尝试制作一个 python 应用程序来存储驱动器中文件的快捷方式

当我尝试在 Drive 中创建快捷方式时,按照文档中的代码..创建的文件始终具有 mimetype“application/octet-stream”,即使我指定“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()

有没有人遇到同样的问题?

最佳答案

mimeType 区分大小写,T 大写:

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

引自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.

关于python - 当我在云端硬盘中创建快捷方式时,它的 mimetype 为 'application/octet-stream',即使我指定了 '' application/vnd.google-apps.drive-sdk'',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24911440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com