# -*- coding: utf-8 -*-
import boto3
from boto3.s3.transfer import TransferConfig
# from s3transfer.manager import TransferConfig
access_key = "xxx"
secret_key = "xxx" cli = boto3.client(
's3',
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
endpoint_url='http://ss.bscstorage.com'
) config = TransferConfig(
multipart_threshold=30 * 1024 * 1024,
multipart_chunksize=8 * 1024 * 1024,
max_concurrency=10,
) # 50MB/s
# 单位是byte
config.max_bandwidth = 50 * 1024 * 1024 resp = cli.upload_file(
'/tmp/VSCode-darwin-stable.zip',
'test',
'test-key-xx2',
ExtraArgs={
'ContentType': 'text/plain', # 请替换为合适的文件类型
'ACL': 'private',
},
Config=config
)