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