#NEWLINE# @ must_have_addon ( SHORT_NAME , 'node' ) #NEWLINE# @ must_be_addon_authorizer ( SHORT_NAME ) #NEWLINE# def googledrive_folder_list( node_addon , **kwargs ) : #NEWLINE# #INDENT# ' Returns all the subsequent folders under the folder id passed.\n        Not easily generalizable due to `path` kwarg.\n    ' #NEWLINE# node = ( kwargs . get ( 'node' ) or node_addon . owner ) #NEWLINE# path = request . args . get ( 'path' , '' ) #NEWLINE# folder_id = request . args . get ( 'folderId' , 'root' ) #NEWLINE# try : #NEWLINE# #INDENT# access_token = node_addon . fetch_access_token ( ) #NEWLINE# #UNINDENT# except InvalidAuthError : #NEWLINE# #INDENT# raise HTTPError ( 403 ) #NEWLINE# #UNINDENT# client = GoogleDriveClient ( access_token ) #NEWLINE# if ( contents == 'root' ) : #NEWLINE# #INDENT# about = client . about ( ) #NEWLINE# return [ { #NEWLINE# #INDENT# 'path' : '/' , #NEWLINE# 'kind' : 'folder' , #NEWLINE# 'id' : about [ 'rootFolderId' ] , #NEWLINE# 'name' : '/ (Full Google Drive)' , #NEWLINE# 'urls' : { #NEWLINE# #INDENT# 'folders' : node . api_url_for ( 'googledrive_folder_list' , folderId = about [ 'rootFolderId' ] ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# contents = [ to_hgrid ( item , node , path = path ) for item in client . folders ( folder_id ) ] #NEWLINE# return contents