sregistry/main/google_drive/query.py
def list_containers(self):
    '''return a list of containers. Since Google Drive definitely has other
       kinds of files, we look for containers in a special sregistry folder,
       (meaning the parent folder is sregistry) and with properties of type
       as container.
    '''
    # Get or create the base
    folder = self._get_or_create_folder(self._base)

    next_page = None
    containers = []

    # Parse the base for all containers, possibly over multiple pages

    while True:
        query = "mimeType='application/octet-stream'"  # ensures container
        query += " and properties has { key='type' and value='container' }"
        query += " and '%s' in parents" %folder['id']   # ensures in parent folder
        response = self._service.files().list(q=query,
                                              spaces='drive',
                                              fields='nextPageToken, files(id, name, properties)',
                                              pageToken=next_page).execute()
        containers += response.get('files', [])
            
        # If there is a next page, keep going!
        next_page = response.get('nextPageToken')
        if not next_page:
            break

    if len(containers) == 0:
        bot.info("No containers found, based on properties type:container")
        sys.exit(1)

    return containers
def list_containers(self):
    '''return a list of containers. Since Google Drive definitely has other
       kinds of files, we look for containers in a special sregistry folder,
       (meaning the parent folder is sregistry) and with properties of type
       as container.
    '''
    # Get or create the base
    folder = self._get_or_create_folder(self._base)

    next_page = None
    containers = []

    # Parse the base for all containers, possibly over multiple pages

    while True:
        query = "mimeType='application/octet-stream'"  # ensures container
        query += " and properties has { key='type' and value='container' }"
        query += " and '%s' in parents" %folder['id']   # ensures in parent folder
        response = self._service.files().list(q=query,
                                              spaces='drive',
                                              fields='nextPageToken, files(id, name, properties)',
                                              pageToken=next_page).execute()
        containers += response.get('files', [])
            
        # If there is a next page, keep going!
        next_page = response.get('nextPageToken')
        if not next_page:
            break

    if len(containers) == 0:
        bot.info("No containers found, based on properties type:container")
        sys.exit(1)

    return containers
return a list of containers. Since Google Drive definitely has other
       kinds of files, we look for containers in a special sregistry folder,
       (meaning the parent folder is sregistry) and with properties of type
       as container.