Python 连接 ceph rgw 示例
2020-05-17 本文已影响0人
ZhiXiong
import boto3
def main():
access_key = "access_key"
secret_key = "secret_key"
s3_host = "http://host:7480"
s3client = boto3.client('s3',
aws_secret_access_key=secret_key,
aws_access_key_id=access_key,
endpoint_url=s3_host
)
bucket_name = "bucket_name"
s3client.download_file(Filename="write_to_file", Bucket=bucket_name, Key="test.png")
if __name__ == '__main__':
main()