smore-inc / tinys3

A simple python S3 upload library. Inspired by requests
MIT License
285 stars 54 forks source link

404 error with tinys3; works with boto and aws #49

Open peterschay opened 8 years ago

peterschay commented 8 years ago

Hello. I can read data from an s3 key using boto and the aws tool but I cannot make it work with tinys3. Any suggestions?

[pete@sand ~]$ python -c "import tinys3; tinys3.Connection(\"$AWS_ACCESS_KEY_ID\", \"$AWS_SECRET_ACCESS_KEY\", tls=False, endpoint='s3-us-west-1.amazonaws.com').get('abc.txt', 'xcp-test')" Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/tinys3/connection.py", line 73, in get File "build/bdist.linux-x86_64/egg/tinys3/connection.py", line 233, in run File "build/bdist.linux-x86_64/egg/tinys3/connection.py", line 255, in _handle_request File "build/bdist.linux-x86_64/egg/tinys3/request_factory.py", line 57, in run File "/usr/local/lib/python2.7/site-packages/requests-2.9.0-py2.7.egg/requests/models.py", line 837, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://s3-us-west-1.amazonaws.com/xcp-test/abc.txt

A short script with boto.s3.connection.S3Connection was able to read the data.

Using the aws client tool works also; when run with debug it shows that the endpoint is indeed us-west-1: aws --debug s3 ls xcp-demo [...] 2015-12-19 17:26:13,046 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amz-bucket-region': 'us-west-1', 'x-amz-id-2': 'bvoaji7VxAeQDaAA4MgzjXdCya/lI3cu8cf1Kdvk0UpJ34e47NT/1Bg7cFCHMFPSp4tWJACJwc8=', 'server': 'AmazonS3', 'transfer-encoding': 'chunked', 'x-amz-request-id': '6726CFD4436DD0B2', 'date': 'Sun, 20 Dec 2015 01:26:13 GMT', 'content-type': 'application/xml'} [...] 2015-12-19 16:10:11 16 abc.txt

Hopefully something simple? Thanks!