我正在尝试获取 s3 存储桶中上传的文件的元数据值
#我必须专门使用 boto3.resource('s3') 来进行项目中的其他 api 调用。
我在元数据字段下有以下可用数据
#元数据
Key=Content-Type
Value= application/json
Run Code Online (Sandbox Code Playgroud)
下面是代码
bucket= 'mybucket'
key='L1/input/file.json'
s3_resource = boto3.resource('s3')
object = s3_resource.Object(bucket,key)
metadata = object.metadata
Run Code Online (Sandbox Code Playgroud)
但我遇到了以下错误
[ERROR] ClientError: An error occurred (403) when calling the HeadObject operation: Forbidden
Run Code Online (Sandbox Code Playgroud)
谁可以帮我这个事。