[Python] Get folder and files Google Drive API with Shared Device and Service Account

Discussão em 'Python' iniciado por Stack, Julho 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working with a Google Service Account, I have access to Google Drive API and a Shared Unit.

    I need to get access to all the files and folders from a Shared Unit. I tried a lot of different ways to do this.

    drive_service.files().list(
    q = f"'{parent_folder}' in parents",
    spaces = 'drive',
    supportsTeamDrives=True
    ).execute()

    >> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}


    drive_service.files().list(
    q = f" parents in '{parent_folder}'",
    spaces = 'drive',
    supportsTeamDrives=True
    ).execute()

    >> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}


    drive_service.files().list(
    spaces = 'drive',
    supportsTeamDrives=True
    ).execute()

    >> {'kind': 'drive#fileList', 'incompleteSearch': False, 'files': []}


    drive_service.drives().list().execute()

    >> {'kind': 'drive#driveList',
    'drives': [{'kind': 'drive#drive',
    'id': '0AOELwkzr21lFUk9VA',
    'name': 'foo'}]}


    I know a have access because I can upload files to the parent folder. Also, there are files in the parent folder.

    Do you have any clue?

    Thank you for your time

    Continue reading...

Compartilhe esta Página