I have the following code for getting a list of objects.
paginator = self.client.get_paginator('list_objects')
async for result in paginator.paginate(Bucket=bucket_name, Prefix=prefix):
for file in result.get('Contents', []):
yield file
What do I need to add to display objects in only one directory, without recursion?
Add Delimiter='/'
kwarg
paginator = self.client.get_paginator('list_objects')
async for result in paginator.paginate(
Bucket=bucket_name,
Prefix=prefix,
Delimiter='/',
):
for file in result.get('Contents', []):
yield file