For some reason, when I took out the data uploaded to S3, I had to get the entire list once before I could get it. The prefix specification was useless.
Sample code
#!/usr/bin/env python
import boto.s3.connection
def main():
s3con = boto.s3.connection.S3Connection('Something like an access key', 'Something secret')
bucket_con = s3con.get_bucket('logs-many')
for k in bucket_con.list(prefix="access_log/2015/02/10/"):
fn = k.name.split('/')[-1]
body = k.get_contents_to_filename('log/' + fn)
print 'Got! ' + fn
if __name__ == '__main__':
main()
So, what was wrong was that I had specified `` `/ logs-many``` in the prefix.
Somehow, when I read the document, it says / foo /, so I thought it was necessary.
Recommended Posts