from boto.s3.connection import S3Connection
conn = S3Connection('access-key','secret-access-key')
bucket = conn.get_bucket('bucket')
for key in bucket.list():
print(key.name.encode('utf-8'))
import boto
conn = boto.connect_s3( <ACCESS_KEY>, <SECRET_KEY> )
try:
bucket = conn.get_bucket( <BUCKET_NAME>, validate = True )
except boto.exception.S3ResponseError, e:
do_something() # The bucket does not exist, choose how to deal with it or raise the exception
return [ key.name.encode( "utf-8" ) for key in bucket.list() ]