python - aws s3 - object has no attribute 'server_side_encryption' -


can please explain differences in these 2 calls. first 1 gives correct server_side_encryption , second 1 gives error. other attributes give same value-

#!/usr/bin/python  import boto3 import botocore  s3 = boto3.resource('s3') s3_client = boto3.client('s3')   object = s3.object('abcdefhkjl9999','error.html')  print(object.bucket_name) print(object.key) print(object.last_modified) print(object.storage_class) print(object.server_side_encryption)   bucket = s3.bucket('abcdefhkjl9999') object in bucket.objects.all():     print("#############################")     print(object.bucket_name)     print(object.key)     print(object.last_modified)     print(object.storage_class)     print(object.server_side_encryption)   output - abcdefhkjl9999 error.html 2017-08-20 22:58:02+00:00 reduced_redundancy aws:kms ############################# abcdefhkjl9999 error.html 2017-08-20 22:58:02+00:00 reduced_redundancy traceback (most recent call last): file "./test3.py", line 26, in <module> print(object.server_side_encryption) attributeerror: 's3.objectsummary' object has no attribute       'server_side_encryption' 

as error received states, object you're trying server_side_encryption attribute not, in fact, of type s3.object, rather of type s3.objectsummary

fortunately can object sub-resource specified here

inner = outer.object() query property

print(inner.server_side_encryption)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -