使用smart_open lib和s3 docker镜像

我试图使用python lib smart_open和s3 docker 镜像来在本地运行一些functiontesting。

Docker在端口4569上运行,我创build了一个testing桶:

 aws s3 ls --endpoint-url http://localhost:4569 2017-04-03 15:17:38 my-bucket 

示例脚本如下所示:

 import smart_open with smart_open.smart_open('s3://my-bucket/mykey.txt', 'wb', host="http://127.0.0.1:4569") as fout: for line in ['first line', 'second line', 'third line']: fout.write(line + '\n') 

回溯的错误:

 Traceback (most recent call last): File "test.py", line 13, in <module> with smart_open.smart_open('s3://my-bucket/mykey.txt', 'wb', host="http://127.0.0.1:4569") as fout: File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/smart_open/smart_open_lib.py", line 142, in smart_open bucket = s3_connection.get_bucket(parsed_uri.bucket_id) File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/boto/s3/connection.py", line 506, in get_bucket return self.head_bucket(bucket_name, headers=headers) File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/boto/s3/connection.py", line 525, in head_bucket response = self.make_request('HEAD', bucket_name, headers=headers) File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/boto/s3/connection.py", line 668, in make_request retry_handler=retry_handler File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/boto/connection.py", line 1071, in make_request retry_handler=retry_handler) File "/Users/giorgiocarta/Scripts/Python_Envs/apollo-petl_env/lib/python2.7/site-packages/boto/connection.py", line 1030, in _mexe raise ex socket.gaierror: [Errno 8] nodename nor servname provided, or not known 

我明白smart_open在场景后面使用boto,我只是无法弄清楚如何通过一个不同的端点。 有什么build议么?