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.6.0.tar.gz (13.8 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.6.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: large_file_upload_sdk-3.6.0.tar.gz
  • Upload date:
  • Size: 13.8 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.6.0.tar.gz
Algorithm Hash digest
SHA256 62fdb9805b16c7a5f9238e302b4e5081451539480760e6413b4c93b7d1706ea7
MD5 8af1793040629a5bf050304aa13606e2
BLAKE2b-256 61fdbee98eeaf310543fe0b448f9fa9bda0e579b1e3b2102e59a362e580b3102

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for large_file_upload_sdk-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8157dfeb2bdc4e746d8da0b0dae6cde8718c61a11df0b98563a3668a50be534e
MD5 4df6fb0bda7bd57bf5a7944355558c99
BLAKE2b-256 fe165c89cb545b03e063e4817383c5de0da8f64c3ddcc31ff49eb697f50cef53

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