lericson/simples3

Add support for buckets in different regions

Opened this issue · 9 comments

When trying to use simples3 to connect to a bucket hosted in eu-west-1, I get the following error:

The bucket you are attempting to access must be addressed using the specified endpoint.

does this fixed or not?

same issue here. this should be top prio.

Tell me how you are trying to connect to it, I used simples3 with European servers many times!

bucket = simples3.S3Bucket(name="mybucket", base_url="http://eu-west.whatever.com/")

I forget exactly how the incantation looks. I'm all for adding a simples3.connect though, or open. Suggestions?

@lericson yes, I had to provide the full url (not just the base) into base_url for it to work. but it does not look so natural. but this looks pretty:

bucket = S3Bucket(name='mybucket', region='us-west1')

Alright, that sounds awesome. Could you perhaps post some example of how to use a different region, so it can be included in the documentation until we get a better API?

I found a solution:

bucket = 'my_bucket'
access_key = 'AAAAAAAAAAAAAAAAAA'
secret_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

s = simples3.S3Bucket(bucket,
    base_url="http://s3-eu-west-1.amazonaws.com/%s" % bucket,
    access_key=access_key,
    secret_key=secret_key)

s.put( 'todel.txt', 'blabla' )

Good stuff, would do well to make a more obvious API though.

  • Ludvig

On 1 feb. 2016, at 10:44, mdauphin notifications@github.com wrote:

I found a solution:

bucket = 'my_bucket'
access_key = 'AAAAAAAAAAAAAAAAAA'
secret_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

s = simples3.S3Bucket(bucket,
base_url="http://s3-eu-west-1.amazonaws.com/%s" % bucket,
access_key=access_key,
secret_key=secret_key)

s.put( 'todel.txt', 'blabla' )

Reply to this email directly or view it on GitHub.