|
|
@ -33,6 +33,7 @@ try:
|
|
|
|
from pydrive.drive import GoogleDrive
|
|
|
|
from pydrive.drive import GoogleDrive
|
|
|
|
from pydrive.auth import RefreshError
|
|
|
|
from pydrive.auth import RefreshError
|
|
|
|
from apiclient import errors
|
|
|
|
from apiclient import errors
|
|
|
|
|
|
|
|
from httplib2 import ServerNotFoundError
|
|
|
|
gdrive_support = True
|
|
|
|
gdrive_support = True
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
gdrive_support = False
|
|
|
|
gdrive_support = False
|
|
|
@ -192,9 +193,13 @@ def getDrive(drive=None, gauth=None):
|
|
|
|
return drive
|
|
|
|
return drive
|
|
|
|
|
|
|
|
|
|
|
|
def listRootFolders():
|
|
|
|
def listRootFolders():
|
|
|
|
drive = getDrive(Gdrive.Instance().drive)
|
|
|
|
try:
|
|
|
|
folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false"
|
|
|
|
drive = getDrive(Gdrive.Instance().drive)
|
|
|
|
fileList = drive.ListFile({'q': folder}).GetList()
|
|
|
|
folder = "'root' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false"
|
|
|
|
|
|
|
|
fileList = drive.ListFile({'q': folder}).GetList()
|
|
|
|
|
|
|
|
except ServerNotFoundError as e:
|
|
|
|
|
|
|
|
log.info("GDrive Error %s" % e)
|
|
|
|
|
|
|
|
fileList = []
|
|
|
|
return fileList
|
|
|
|
return fileList
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|