简体   繁体   English

我可以使用 Python 服务帐户创建 Google Drive 文件夹吗?

[英]Can I create a Google Drive folder using service account with Python?

I can create a folder using account Owner but cannot share it with service account.我可以使用帐户所有者创建文件夹,但不能与服务帐户共享。

Is there a way for My Python script to create a folder using service account and then upload a file?我的 Python 脚本有没有办法使用服务帐户创建文件夹然后上传文件?

You can create a folder and upload file, same process flow as a real user when you using a service account.您可以创建文件夹并上传文件,使用服务帐户时与真实用户相同的流程。

BUT但是

As stated in this blog , you have to remember that:如本博客所述,您必须记住:

A service account is a sort of virtual user or robot account associated with a given project.服务帐户是一种与给定项目关联的虚拟用户或机器人帐户。 It has an email address, and a cryptographic key pair.它有一个电子邮件地址和一个加密密钥对。

Also, there is a statement from a related SO question that:此外,还有来自相关SO 问题的声明:

There is no UI for Service Accounts.服务帐户没有 UI。 The files are only accessible to your app.这些文件只能由您的应用访问。

I suggest that you share a folder from a real account to your service account so that accessing the files would be easier.我建议您将真实帐户中的文件夹共享到您的服务帐户,以便更轻松地访问文件。

Hope this help!希望这有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Python 中使用 Google Drive API 创建新文件夹? - How can I create a new folder with Google Drive API in Python? 使用服务帐户密钥的 Google Drive Python API 授权 - Google Drive Python API authorization using service account key 在谷歌驱动器上创建一个文件夹(如果不存在)并使用 Python 脚本将文件上传到它 - Create a folder (if not exists) on google drive and upload a file to it using Python script Python-使用gspread在Google云端硬盘的特定文件夹中创建电子表格 - Python - Using gspread to create a spreadsheet in a specific folder in Google Drive 如何使用 python 脚本在谷歌驱动器中创建和显示文件夹? - How to create and show a folder in google drive using python script? 使用共享设备和服务帐户获取文件夹和文件 Google Drive API - Get folder and files Google Drive API with Shared Device and Service Account 如何使用 Python 将文件插入/上传到 Google Drive API v3 中的特定文件夹 - How can I insert/upload files to a specific folder in Google Drive API v3 using Python 如何在 Python 中使用服务帐户凭据创建 Google 表格? - How to create Google Sheets using Service Account Credential in Python? 为什么在 Python 中使用 Google 地球引擎并通过服务帐户进行身份验证时,导出到驱动器的内容为空? - Why is the export to the Drive empty, when using Google Earth Engine in Python with authentication through service account? Google Drive API 使用 python 中的服务帐户未显示与我共享的文件夹 - Google Drive API using Service Account in python not showing up folders that are shared to me
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM