Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

use latest file on aws s3 bucket python

get_last_modified = lambda obj: int(obj['LastModified'].strftime('%s'))

s3 = boto3.client('s3')
objs = s3.list_objects_v2(Bucket='my_bucket')['Contents']
last_added = [obj['Key'] for obj in sorted(objs, key=get_last_modified)][0]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #latest #file #aws #bucket #python
ADD COMMENT
Topic
Name
5+1 =