python-3.x - GoogleDrive API 文件上传
问题描述
我正在尝试使用 Google Drive API 上传文件,即使在程序执行完成后,Google Drive 中也缺少该文件。
from Google import Create_Service
from googleapiclient.http import MediaFileUpload
Client_Secret = 'client_secret.json'
API_name = 'drive'
API_ver = 'v3'
Scope = ['https://www.googleapis.com/auth/drive']
service = Create_Service(Client_Secret,API_name,API_ver,Scope)
file_metadata = {'name': 'download.jpg'}
media = MediaFileUpload('./download.jpg', mimetype='image/jpeg')
file = service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
print ('File ID: %s' % file.get('status'))
执行代码后,我可以在 Program 结束时获取 fileId。但无法在我的驱动器中找到上传文件。
client_secret.json-drive-v3-(['https://www.googleapis.com/auth/drive'],)
['https://www.googleapis.com/auth/drive']
drive service created successfully
File ID: 1UoTUr7kKh6fN_usX1FXOvCM4dbD2hx9e
有没有人遇到过这种问题...?
解决方案
推荐阅读
- python - 基于另一列创建新列
- html - 勾选符号未出现在 xslt 中
- python - 在 Cython 中迭代 Unicode 字符串和替换字符的最快方法是什么?
- unity3d - 流式传输时,在强制执行 IsFinal 响应之前,一个人可以持续说话的时间是否有限制
- c# - OpenXML SDK - 在 Excel 中断开外部链接
- c - C 语言中的阶乘程序在 Turbo C++ 和移动应用程序中显示不同的输出(Turbo C++ 输出错误)
- jquery - 使用 ajax 将文件和原始类型上传到 Web Api
- mongodb - Go mongo-driver 无法连接到 mongodb 容器
- docker - 使用 docker 进行 Elasticsearch 和搜索 UI
- php - 我如何获得我收到的电子邮件中显示的电话号码和姓名 - PHPMailer