Skip to content

Commit fa5943d

Browse files
author
Eric Koleda
committed
Move the file-level doc block to the main method.
1 parent 1f767b2 commit fa5943d

File tree

14 files changed

+57
-75
lines changed

14 files changed

+57
-75
lines changed

admin_sdk/directory/quickstart.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START admin_sdk_directory_quickstart]
16-
"""
17-
Shows basic usage of the Admin SDK Directory API. Lists the first 10 users in
18-
the domain.
19-
"""
2016
from __future__ import print_function
2117
from apiclient.discovery import build
2218
from httplib2 import Http
@@ -27,7 +23,9 @@
2723

2824

2925
def main():
30-
"""Runs the sample.
26+
"""Shows basic usage of the Admin SDK Directory API.
27+
28+
Prints the emails and names of the first 10 users in the domain.
3129
"""
3230
store = file.Storage('token.json')
3331
creds = store.get()

admin_sdk/reports/quickstart.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START admin_sdk_reports_quickstart]
16-
"""
17-
Shows basic usage of the Admin SDK Reports API. Outputs a list of last 10 login
18-
events.
19-
"""
2016
from __future__ import print_function
2117
from apiclient.discovery import build
2218
from httplib2 import Http
@@ -27,7 +23,9 @@
2723

2824

2925
def main():
30-
"""Runs the sample.
26+
"""Shows basic usage of the Admin SDK Reports API.
27+
28+
Prints the time, email, and name of the last 10 login events in the domain.
3129
"""
3230
store = file.Storage('token.json')
3331
creds = store.get()

admin_sdk/reseller/quickstart.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,40 @@
1414

1515
# [START admin_sdk_reseller_quickstart]
1616
"""
17-
Shows basic usage of the Admin SDK Reports API. Outputs a list of last 10 login
18-
events.
17+
Shows basic usage of the Admin SDK Reseller API. Prints the customer ID, SKU ID,
18+
and plan name of the first 10 subscriptions managed by the domain.
1919
"""
2020
from __future__ import print_function
2121
from apiclient.discovery import build
2222
from httplib2 import Http
2323
from oauth2client import file, client, tools
2424

2525
# If modifying these scopes, delete the file token.json.
26-
SCOPES = 'https://www.googleapis.com/auth/admin.reports.audit.readonly'
26+
SCOPES = 'https://www.googleapis.com/auth/apps.order'
2727

2828

2929
def main():
30-
"""Runs the sample.
30+
"""Calls the Admin SDK Reseller API.
3131
"""
3232
store = file.Storage('token.json')
3333
creds = store.get()
3434
if not creds or creds.invalid:
3535
flow = client.flow_from_clientsecrets('credentials.json', SCOPES)
3636
creds = tools.run_flow(flow, store)
37-
service = build('admin', 'reports_v1', http=creds.authorize(Http()))
37+
service = build('reseller', 'v1', http=creds.authorize(Http()))
3838

39-
print('Getting the last 10 login events')
40-
results = service.activities().list(userKey='all', applicationName='login',
41-
maxResults=10).execute()
42-
activities = results.get('items', [])
39+
print('Getting the first 10 subscriptions')
40+
results = service.subscriptions().list(maxResults=10).execute()
41+
subscriptions = results.get('subscriptions', [])
4342

44-
if not activities:
45-
print('No logins found.')
43+
if not subscriptions:
44+
print('No subscriptions found.')
4645
else:
47-
print('Logins:')
48-
for activity in activities:
49-
print(u'{0}: {1} ({2})'.format(activity['id']['time'],
50-
activity['actor']['email'],
51-
activity['events'][0]['name']))
46+
print('Subscriptions:')
47+
for subscription in subscriptions:
48+
print(u'{0} ({1}, {2})'.format(subscription['customerId'],
49+
subscription['skuId'],
50+
subscription['plan']['planName']))
5251

5352

5453
if __name__ == '__main__':

apps_script/quickstart/quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343

4444
def main():
45-
"""Runs the sample.
45+
"""Calls the Apps Script API.
4646
"""
4747
store = file.Storage('token.json')
4848
creds = store.get()

calendar/quickstart/quickstart.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START calendar_quickstart]
16-
"""
17-
Shows basic usage of the Google Calendar API. Creates a Google Calendar API
18-
service object and outputs a list of the next 10 events on the user's calendar.
19-
"""
2016
from __future__ import print_function
2117
from apiclient.discovery import build
2218
from httplib2 import Http
@@ -28,7 +24,9 @@
2824

2925

3026
def main():
31-
"""Runs the sample.
27+
"""Shows basic usage of the Google Calendar API.
28+
29+
Prints the start and name of the next 10 events on the user's calendar.
3230
"""
3331
store = file.Storage('token.json')
3432
creds = store.get()

classroom/quickstart/quickstart.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START classroom_quickstart]
16-
"""
17-
Shows basic usage of the Classroom API.
18-
19-
Creates a Classroom API service object and prints the names of the first
20-
10 courses the user has access to.
21-
"""
2216
from __future__ import print_function
2317
from apiclient.discovery import build
2418
from httplib2 import Http
@@ -29,7 +23,9 @@
2923

3024

3125
def main():
32-
"""Runs the sample.
26+
"""Shows basic usage of the Classroom API.
27+
28+
Prints the names of the first 10 courses the user has access to.
3329
"""
3430
store = file.Storage('token.json')
3531
creds = store.get()

drive/activity/quickstart.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525

2626
def main():
27-
"""Runs the sample.
27+
"""Shows basic usage of the Drive Activity API.
28+
29+
Prints information about the last 10 events that occured the user's Drive.
2830
"""
2931
store = file.Storage('token.json')
3032
creds = store.get()

drive/quickstart/quickstart.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START drive_quickstart]
16-
"""
17-
Shows basic usage of the Drive v3 API.
18-
19-
Creates a Drive v3 API service and prints the names and ids of the last 10 files
20-
the user has access to.
21-
"""
2216
from __future__ import print_function
2317
from apiclient.discovery import build
2418
from httplib2 import Http
@@ -29,7 +23,9 @@
2923

3024

3125
def main():
32-
"""Runs the sample.
26+
"""Shows basic usage of the Drive v3 API.
27+
28+
Prints the names and ids of the first 10 files the user has access to.
3329
"""
3430
store = file.Storage('token.json')
3531
creds = store.get()

gmail/quickstart/quickstart.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START gmail_quickstart]
16-
"""
17-
Shows basic usage of the Gmail API.
18-
19-
Lists the user's Gmail labels.
20-
"""
2116
from __future__ import print_function
2217
from apiclient.discovery import build
2318
from httplib2 import Http
@@ -28,7 +23,9 @@
2823

2924

3025
def main():
31-
"""Runs the sample.
26+
"""Shows basic usage of the Gmail API.
27+
28+
Lists the user's Gmail labels.
3229
"""
3330
store = file.Storage('token.json')
3431
creds = store.get()

people/quickstart/quickstart.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# limitations under the License.
1414

1515
# [START people_quickstart]
16-
"""
17-
Shows basic usage of the People API. Outputs the name 10 connections.
18-
"""
1916
from __future__ import print_function
2017
from apiclient.discovery import build
2118
from httplib2 import Http
@@ -26,7 +23,9 @@
2623

2724

2825
def main():
29-
"""Runs the sample.
26+
"""Shows basic usage of the People API.
27+
28+
Prints the name of the first 10 connections.
3029
"""
3130
store = file.Storage('token.json')
3231
creds = store.get()

0 commit comments

Comments
 (0)