Skip to main content

Large File Upload SDK - Support chunked upload, resumable transfer, and Token authentication

Project description

File Upload SDK

上传文件到阿里云 OSS 的 Python SDK

安装

pip install large-file-upload-sdk

使用方法

1. 初始化 SDK

from file_upload_sdk import FileUploadSDK

sdk = FileUploadSDK(
    base_url="http://file-upload-server-staging.ai4s.infly.tech/",  # 服务地址
    user_id=12345,            # 你的用户ID(从平台个人中心获取)
    user_name="张三",          # 你的用户名
)
参数 说明 获取方式
base_url 上传服务地址 由管理员提供
user_id 用户ID 登录平台后在个人中心查看
user_name 用户名 你的平台用户名
dataset_id 数据集ID 在平台创建数据集后获取

2. 上传文件夹

result = sdk.upload_folder(
    folder_path="/path/to/your/folder",       # 本地文件夹路径
    dataset_id="419390545334853632",           # 目标数据集ID
)

print(f"总计: {result['total']}, 成功: {result['succeeded']}, 失败: {result['failed_count']}")

3. 上传单个文件

result = sdk.upload_file(
    file_path="/path/to/file.tar.gz",          # 本地文件路径
    dataset_id="419390545334853632",           # 目标数据集ID
)

if result["success"]:
    print(f"上传成功! 路径: {result.get('file_path', '')}")
else:
    print(f"上传失败: {result['error']}")

常见问题

中断了怎么办? 重新执行同样的命令即可,已上传的文件会自动跳过。

支持多大的文件/目录? 单文件最大 5TB,目录大小无限制。

ossutil 需要手动安装吗? 不需要,首次上传文件夹时会自动下载安装。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

large_file_upload_sdk-3.5.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

large_file_upload_sdk-3.5.3-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file large_file_upload_sdk-3.5.3.tar.gz.

File metadata

  • Download URL: large_file_upload_sdk-3.5.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for large_file_upload_sdk-3.5.3.tar.gz
Algorithm Hash digest
SHA256 253a2fe00505693e04407098144ba0551afcfa44c0980509c6f3db69d57fef3a
MD5 fe4399d3b0abc88bc1529f5e13824004
BLAKE2b-256 abe071ca00e55356b8a98e8d31d7d709d387831784f36eadea0db4ffd4803b95

See more details on using hashes here.

File details

Details for the file large_file_upload_sdk-3.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for large_file_upload_sdk-3.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d34909b44ce19a8503aaebcec10cf8b3966b8452a4617a2f92993703dfd7bb
MD5 a3baa46ad4b1e83dc0bc36e88485b23a
BLAKE2b-256 973a4629c2be4d4130172cb19a9bd3f836950cd42ebb03aee8075ddb1b25b609

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page