Created
January 9, 2014 16:26
-
-
Save esacteksab/8337083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
#connect to s3 | |
c = boto.connect_s3() | |
#get bucket | |
bucket = c.get_bucket('bucket_name') | |
#files are keys | |
bucket.get_all_keys() | |
#get attributes on a key (file) | |
keys = bucket.get_all_keys() | |
#for files in bucket | |
for key in keys: | |
print key | |
print key.last_modified | |
#get first key -- remove/comment out 'break' below for testing | |
break | |
""" | |
key returned is <class 'boto.s3.key.Key'> | |
http://boto.readthedocs.org/en/latest/ref/s3.html#module-boto.s3.key | |
The above will return something like: | |
<Key: bucket_name,file_name> | |
2013-12-26T21:26:27.000z | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment