peterknife / boto

Automatically exported from code.google.com/p/boto
0 stars 0 forks source link

S3Connection.get_all_buckets() incorrectly constructs S3ResponseError. #540

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Execute the following:

        s3_conn = S3Connection(access_key, secret_key, host=s3_host)

        bucket = None
        try:
            buckets = s3_conn.get_all_buckets()
        except S3ResponseError, e:
            print ("Failed to connect to S3 with credentials,"
                   "to find bucket. Got error: %s" % e)

What is the expected output? What do you see instead?

You expect to get an S3ResponseError object if s3_conn.get_all_buckets() fails 
to connect to S3.

Instead, you get something like this:

Traceback (most recent call last):
...
  File "/usr/lib/pymodules/python2.7/boto/s3/connection.py", line 252, in get_all_buckets
    raise S3ResponseError(response.status, response.reason, body, headers=headers)
TypeError: __init__() got an unexpected keyword argument 'headers'

What version of the product are you using? On what operating system?

1.9b

2.0+ works fine.

class S3ResponseError(BotoServerError):
    """
    Error in response from S3.
    """
    def __init__(self, status, reason, body=None):
        self.resource = None
        BotoServerError.__init__(self, status, reason, body)

No headers kwarg in S3ResponseError.__init__()... looks like line 252 of 
s3/connection.py just needs to have the headers param removed.

Cheers,
jay

Original issue reported on code.google.com by jaypi...@gmail.com on 29 Jul 2011 at 6:44