Там у вас есть простой фрагмент.Короче говоря, вы должны перебирать файлы, чтобы найти дату последнего изменения во всех файлах.Затем у вас есть файлы для печати с этой датой (может быть больше одного).
from datetime import datetime
import boto3
s3 = boto3.resource('s3',aws_access_key_id='demo', aws_secret_access_key='demo')
my_bucket = s3.Bucket('demo')
last_modified_date = datetime(1939, 9, 1).replace(tzinfo=None)
for file in my_bucket.objects.all():
# print(file.key)
file_date = file.last_modified.replace(tzinfo=None)
if last_modified_date < file_date:
last_modified_date = file_date
print(last_modified_date)
# you can have more than one file with this date, so you must iterate again
for file in my_bucket.objects.all():
if file.last_modified.replace(tzinfo=None) == last_modified_date:
print(file.key)
print(last_modified_date)