【发布时间】:2018-01-11 14:42:25
【问题描述】:
我正在使用一个容器来模拟在 http://127.0.0.1:4569 上运行的 S3 服务器(无需授权或凭据)
我正在尝试使用 python 和 boto3 简单地连接并打印所有存储桶名称的列表
这是我的 docker-compose:
s3:
image: andrewgaul/s3proxy
environment:
S3PROXY_AUTHORIZATION: none
hostname: s3
ports:
- 4569:80
volumes:
- ./data/s3:/data
这是我的代码:
s3 = boto3.resource('s3', endpoint_url='http://127.0.0.1:4569')
for bucket in s3.buckets.all():
print(bucket.name)enter code here
这是我收到的错误消息:
botocore.exceptions.NoCredentialsError: Unable to locate credentials
我试过这个解决方案 => How do you use an HTTP/HTTPS proxy with boto3?
但还是不行,我不明白我做错了什么
【问题讨论】:
标签: python amazon-s3 docker-compose boto3 s3proxy