iterative / PyDrive2

Google Drive API Python wrapper library. Maintained fork of PyDrive.
https://docs.iterative.ai/PyDrive2
Other
570 stars 70 forks source link

problem with InsertPermission() optional parameters: sendNotificationEmails=False is not working #258

Closed sagarsharma19 closed 1 year ago

sagarsharma19 commented 1 year ago

I am trying to insert optional parameter sendNotificationEmails=False to InsertPermission , but getting an error.

Code Snippet :

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive

gauth = GoogleAuth()
gauth.LoadCredentialsFile("mycreds.txt")
drive = GoogleDrive(gauth)

params = {'sendNotificationEmails' = False}
gfile = drive.CreateFile({'parents': [{'id': 'SomeID'}]})
gfile.SetContentFile(file)
gfile.Upload()
gfile.InsertPermission({'type': 'user','value': 'email','role': 'writer'},params)

Error message :

InsertPermission() takes 2 positional arguments but 3 were given

shcheklein commented 1 year ago

@sagarsharma19 params = {'sendNotificationEmails' = False} doesn't look like a valid Python code to me?

Assuming that you are actually using params = {'sendNotificationEmails': False}, could you check what version of PyDrive2 you use? It might be outdated

sagarsharma19 commented 1 year ago

@shcheklein sorry for the typo , I was using params = {'sendNotificationEmails': False} only . I upgraded the version and then tried it worked fine. Thank you so much for your guidance.