Skip to main content
 首页 » 编程设计

python之如何使用 drive-sdk 共享文件

2024年10月25日26Terrylee

我想知道如何使用 drive-sdk 和 python 与用户共享文件。我一直在使用下面的代码,但它不会与指定用户共享文件,也不会产生错误:

... 
 
Permission = { 
  'value': 'user@example.com', 
  'type' : 'user', 
  'role' : 'reader' 
} 
 
drive.permissions().insert(fileId=file['id'], body = Permission,sendNotificationEmails = True ) 

请您参考如下方法:

原因是你执行失败。应该是

drive.permissions().insert(fileId=file['id'], body=Permission, sendNotificationEmails=True ).execute()