Skip to content

Commit cfd864a

Browse files
author
Ben Creech
committed
Fix various errors in Python eample for Apps Script execution API
1 parent a04a895 commit cfd864a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps_script/execute/execute.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)