Content-Disposition S3

0

How to find Content-Disposition of every object stored inside a given S3 bucket (which API is best suited for it)?

Thanks

2개 답변
0

If it is set as a part of meta data then we can try to explore below cli api example.

get-object-attributes - Retrieves all the metadata from an object without returning the object itself. This action is useful if you’re interested only in an object’s metadata. To use GetObjectAttributes , you must have READ access to the object.

profile pictureAWS
전문가
답변함 2년 전
0

I just wrote this piece of code to test this feature out:

from pickle import OBJ
import boto3

client = boto3.client('s3')
list_buckets = client.list_buckets()
for bucket in list_buckets['Buckets']:
   list_objects = client.list_objects(Bucket=bucket['Name'])
   for objkey in list_objects['Contents']:        
    get_object = client.get_object(
        Bucket=bucket['Name'],
        Key=objkey['Key'],
        ResponseContentDisposition='inline'
    )

    print(f"{bucket['Name']} ---> {get_object['Metadata']}")

And I am receiving the output as:

<bucket_name> ---> {}

Any specific reason I am getting empty object.

Thanks

profile picture
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠