I have S3 access only to a specific directory in an S3 bucket.
For example, with the s3cmd command if I try to list the whole bucket:
s3cmd
This can be done using:
s3_client = boto3.client('s3') objects = s3_client.list_objects_v2(Bucket='bucket_name') for obj in objects['Contents']: print(obj['Key'])