0
是否可以在PyDrive中使用InsertPermission()
發送可選查詢參數的值? PyDrive文檔似乎忽略瞭如何處理切換可選參數,如sendNotificationEmails
。PyDrive中帶有InsertPermission()的可選查詢參數
我需要爲特定用戶(而不是任何人)添加權限,而不發送通知電子郵件,並且sendNotificationEmails
默認設置爲True
。
我已經考慮修改files.py的定義的函數以下,但我不知道這是否會工作,以前沒有編輯過的庫文件:
def InsertPermission(self, new_permission):
"""Insert a new permission. Re-fetches all permissions after call.
:param new_permission: The new permission to insert, please see the official Google Drive API guide on permissions.insert for details.
:type new_permission: object
:return: The permission object.
:rtype: object
"""
file_id = self.metadata.get('id') or self['id']
try:
permission = self.auth.service.permissions().insert(fileId=file_id, body=new_permission, sendNotificationEmails=False).execute(http=self.http)
except errors.HttpError as error:
raise ApiRequestError(error)
else:
self.GetPermissions() # Update permissions field.
return permission
不要修改庫的代碼。向PyDrive維護人員發送功能請求,並且直到它實現了您自己項目中修改過的代碼的副本。 –
PyDrive維護者在這裏,打開一個錯誤在這裏:https://github.com/googledrive/PyDrive/issues。您可以分叉庫並進行更改。如果他們工作,我很樂意將他們合併到主庫中。 –