# -*- 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
)

  

相关文章:

  • 2021-12-08
  • 2022-01-18
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
猜你喜欢
  • 2022-02-11
  • 2021-12-21
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-10-03
相关资源
相似解决方案