2

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?

Fyzzys
  • 756
  • 1
  • 7
  • 13

1 Answers1

1

Add Delimiter='/' kwarg

async for result in paginator.paginate(Bucket=bucket_name, Prefix=prefix, Delimiter='/'):
        for file in result.get('Contents', []):
            yield file
echo
  • 26
  • 3