sregistry/main/google_drive/utils.py
def get_or_create_folder(self, folder):
    '''create a folder at the drive root. If the folder already exists,
       it is simply returned.

           folder = self._get_or_create_folder(self._base)
           $ folder
             {'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}

    '''
    q = "mimeType='application/vnd.google-apps.folder' and name='%s'" %folder
    response = self._service.files().list(q=q,
                                          spaces='drive').execute().get('files',[])

    # If no folder is found, create it!
    if len(response) == 0:            
        folder = self._create_folder(folder)
    else:
        folder = response[0]
    return folder
def get_or_create_folder(self, folder):
    '''create a folder at the drive root. If the folder already exists,
       it is simply returned.

           folder = self._get_or_create_folder(self._base)
           $ folder
             {'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}

    '''
    q = "mimeType='application/vnd.google-apps.folder' and name='%s'" %folder
    response = self._service.files().list(q=q,
                                          spaces='drive').execute().get('files',[])

    # If no folder is found, create it!
    if len(response) == 0:            
        folder = self._create_folder(folder)
    else:
        folder = response[0]
    return folder
def get_or_create_folder ( self , folder ) : q = "mimeType='application/vnd.google-apps.folder' and name='%s'" % folder response = self . _service . files ( ) . list ( q = q , spaces = 'drive' ) . execute ( ) . get ( 'files' , [ ] ) # If no folder is found, create it! if len ( response ) == 0 : folder = self . _create_folder ( folder ) else : folder = response [ 0 ] return folder
create a folder at the drive root. If the folder already exists,
       it is simply returned.

           folder = self._get_or_create_folder(self._base)
           $ folder
             {'id': '1pXR5S8wufELh9Q-jDkhCoYu-BL1NqN9y'}
create a folder at the drive root . If the folder already exists it is simply returned .