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="https://file-upload-server.ai4s.com.cn/",  # 服务地址
    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.4.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.4-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for large_file_upload_sdk-3.5.4.tar.gz
Algorithm Hash digest
SHA256 cdf604f6b977ea381b7ee6b8db26f6ed14c524584767d34106d964a90235d7db
MD5 2f5c8f449d68f795b1b59e0e1b52da7f
BLAKE2b-256 1764a71301c8641b087ba37738095b4f6dbe9917cb04aaf5b4fa974f3c20375a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for large_file_upload_sdk-3.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 88c530b940688b125140b90b46531b18432700163b7471ba801f9e581a6235b7
MD5 6b960de346908c40fcdd726019fe5aa6
BLAKE2b-256 1778602b06c16713870f250500d9e6b4fb8ecd498396746d810b9d1c45904df1

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