mardi 31 mars 2015

boto get_bucket exception for some buckets

I am trying to access my AWS buckets with boto.


I can list all my buckets like this:



import boto

c = boto.connect_s3()

rs = c.get_all_buckets()
for b in rs:
print b.name


However some buckets I cannot access like this:



print c.get_bucket('mybucket')


The error I get is the following:



File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/boto/s3/connection.py", line 502, in get_bucket
return self.head_bucket(bucket_name, headers=headers)
File "/usr/local/lib/python2.7/site-packages/boto/s3/connection.py", line 549, in head_bucket
response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 400 Bad Request


Is this related to the bucket policy? Or what else could the reason be?





Aucun commentaire:

Enregistrer un commentaire