[英]Set Google Doc to shared and editable by everyone with the link through Google Drive API
I'm not sure how to accomplish this in Python - I've understood how to create a Google Doc using the docs API, but I'm struggling on understanding the Drive API and how to use it with Python. I'm not sure how to accomplish this in Python - I've understood how to create a Google Doc using the docs API, but I'm struggling on understanding the Drive API and how to use it with Python.
The documentation makes it clear that I have to insert a permission with 'editor' and 'everyone' somewhere, but I'm not sure what the actual code should be.文档清楚地表明我必须在某处插入带有“编辑器”和“所有人”的权限,但我不确定实际代码应该是什么。 Any help?有什么帮助吗?
Afterwards, in order to simulate the request you want, you can make use of the Try this API tool.之后,为了模拟您想要的请求,您可以使用Try this API工具。
So as to update the permissions of a file, the request will have to look something similar to this:为了更新文件的权限,请求必须类似于以下内容:
Request要求
PATCH https://www.googleapis.com/drive/v3/files/fileId/permissions/permissionId
Body身体
{
"kind": "drive#permission",
"role": "YOUR_ROLE"
}
As for applying this in Python, you can easily update and adapt the code from the quickstart such that it fits your requirements.至于在 Python 中应用此功能,您可以轻松地更新和调整快速入门中的代码,使其符合您的要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.