I am trying to use PyDrive to programmatically list and then download files stored on a Team Drive that I can access in a browser. When I do this:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
drive = GoogleDrive(gauth)
file_list = drive.ListFile(
{
'q': "'root' in parents and trashed=false",
'corpora': "teamDrive",
'teamDriveId': <team drive ID>,
'includeTeamDriveItems': "true",
'supportsTeamDrives': "true"
}
).GetList()
for file1 in file_list:
print('title: %s, id: %s' % (file1['title'], file1['id']))
I only get the list of files on my personal drive, not the team drive. What am I doing wrong?
Note1: I got the <team drive ID>
by opening the Team Drive (the root folder) in the browser and copying everything after "https://drive.google.com/drive/folders/"
Note2: Browser pops up at drive.ListFile
and gives Authentication successful.