@@ -24,14 +24,17 @@ def main():
2424 """
2525 SCRIPT_ID = 'ENTER_YOUR_SCRIPT_ID_HERE'
2626
27- # Setup the Apps Script API
28- SCOPES = 'https://www.googleapis.com/auth/script.projects'
27+ # Set up the Apps Script API
28+ SCOPES = [
29+ 'https://www.googleapis.com/auth/script.scriptapp' ,
30+ 'https://www.googleapis.com/auth/drive.readonly' ,
31+ ]
2932 store = oauth_file .Storage ('token.json' )
3033 creds = store .get ()
3134 if not creds or creds .invalid :
3235 flow = client .flow_from_clientsecrets ('credentials.json' , SCOPES )
3336 creds = tools .run_flow (flow , store )
34- service = build ('script' , 'v1' , http = creds . authorize ( Http ()) )
37+ service = build ('script' , 'v1' , credentials = creds )
3538
3639 # Create an execution request object.
3740 request = {"function" : "getFoldersUnderRoot" }
@@ -67,7 +70,7 @@ def main():
6770 print ('No folders returned!' )
6871 else :
6972 print ('Folders under your root folder:' )
70- for (folderId , folder ) in folderSet .iteritems ():
73+ for (folderId , folder ) in folderSet .items ():
7174 print ("\t {0} ({1})" .format (folder , folderId ))
7275
7376 except errors .HttpError as e :
0 commit comments