I have a bucket name stored as string
s3_dest1 = "s3://fbg-hg/AGLUE/MYSQL/QUERY1/"
s3_dest2 = "s3://fbg-hg/AGLUE/MYSQL/QUERY2/"
s3_dest3 = "s3://fbg-hg/AGLUE/MYSQL/QUERY3/"
s3_dest4 = "s3://fbg-hg/AGLUE/MYSQL/QUERY4/"
s3_dest5 = "s3://fbg-hg/AGLUE/MYSQL/QUERY5/"
s3_dest6 = "s3://fbg-hg/AGLUE/MYSQL/QUERY6/"
I want to download the files from this s3 bucket and end an email as an attachment. There will be only one file in this folder but to get this file we need to iterate over the folder because i will not be knowing the name of the file.
This is what i am doing but this code gives me error.
AttributeError: 'str' object has no attribute 'objects'
Here is my python code
my_list = [s3_dest1, s3_dest2,s3_dest3,s3_dest4,s3_dest5,s3_dest6]
for s3_dest in my_list:
s3=boto3.client('s3')
for s3_object in s3_dest.objects.all():
filename = os.path.split(s3_object.key)
print(filename)
I am new to python