Skip to content

Commit 25d0540

Browse files
author
Jonathan Wayne Parrott
committed
Merge pull request #73 from GoogleCloudPlatform/storage
Add annotation for just the list_bucket part
2 parents e3111b4 + 087a270 commit 25d0540

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

storage/list_objects.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,24 @@ def main(argv):
4848
# Parse the command-line flags.
4949
args = parser.parse_args(argv[1:])
5050

51+
# [START list_bucket]
5152
# Get the application default credentials. When running locally, these are
5253
# available after running `gcloud auth login`. When running on compute
5354
# engine, these are available from the environment.
5455
credentials = GoogleCredentials.get_application_default()
5556

56-
# Construct the service object for interacting with the Cloud Storage API.
57+
# Construct the service object for interacting with the Cloud Storage API -
58+
# the 'storage' service, at version 'v1'.
59+
# You can browse other available api services and versions here:
60+
# https://developers.google.com/api-client-library/python/apis/
5761
service = discovery.build('storage', 'v1', credentials=credentials)
5862

59-
# Make a request to buckets.get to retrieve information about the bucket.
63+
# Make a request to buckets.get to retrieve a list of objects in the
64+
# specified bucket.
6065
req = service.buckets().get(bucket=args.bucket)
6166
resp = req.execute()
6267
print json.dumps(resp, indent=2)
68+
# [END list_bucket]
6369

6470
# Create a request to objects.list to retrieve a list of objects.
6571
fields_to_return = \

0 commit comments

Comments
 (0)