Skip to content

Commit 4ba7cc4

Browse files
Just print name -- do not create dictionary object
1 parent da6739d commit 4ba7cc4

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

samples/getBucket.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
if len(sys.argv) > 2:
2424
prefix = sys.argv[2]
2525

26-
# create a dictionary to contain object names
27-
object_dict={}
28-
object_dict[bucket]=[]
29-
3026
# get_bucket returns max 1000 objects -- use pagination to get more
3127
getMore = True
3228
marker = None
@@ -41,10 +37,7 @@
4137
getMore = resp.result["IsTruncated"] == 'true'
4238
marker = resp.result["NextMarker"]
4339

44-
# extract what is wanted from get_bucket response; key is object name
45-
objectNames = [bucket['Key'] for bucket in resp.result['ContentsList']]
46-
for name in objectNames:
47-
object_dict[bucket].append(name)
40+
# extract and print what is wanted from get_bucket response; key is object name
41+
for contents in resp.result["ContentsList"]:
42+
print(contents['Key'])
4843

49-
# print object list in JSON
50-
print(object_dict)

0 commit comments

Comments
 (0)