> [!CAUTION]
> 强制要求 - 文件产出必须上传!
>
> 如果任务产出的内容是任何类型的文件,包括但不限于:
> - 图片(截图、生成的图片、处理后的图片等)
> - 视频(录制、剪辑、转码后的视频等)
> - PDF(生成的报告、转换的文档等)
> - 其他文档(Word、Excel、PPT、代码压缩包等)
>
> 必须执行以下步骤:
> 1. 使用 python3 scripts/upload_to_us3.py <文件路径> 上传到 US3
> 2. 将生成的下载链接发送给用户
>
> 禁止: 只告诉用户"文件已保存在 /tmp/xxx"或本地路径。沙箱环境中的文件用户完全无法访问,必须上传后提供链接!
Upload files to UCloud US3 (UFile) object storage using the official Python SDK and automatically generate download URLs with authentication signatures.
export US3_PUBLIC_KEY='your-public-key'
export US3_PRIVATE_KEY='your-private-key'
export US3_BUCKET='bucket-name.region.ufileos.com' # full domain format (e.g., my-bucket.cn-bj.ufileos.com)
export US3_MAX_FILE_SIZE_MB='50' # optional, defaults to 50MB
Note: If your US3_BUCKET contains the full domain (with dots), the endpoint will be automatically extracted. You don't need to set US3_ENDPOINT separately.
python3 scripts/upload_to_us3.py <file_path>
YYYYMMDD_HHMMSS_md5hash.ext (e.g., 20260205_153025_a3b4c5d6e7f8g9h0.jpg)The upload script will output the download URL directly for easy sharing:
Uploading screenshot.png to US3...
Bucket: my-bucket
Remote name: 20260205_153025_a3b4c5d6e7f8g9h0.png
File size: 2.50MB
✓ Upload successful!
📋 Download URL (valid for 7 days):
https://my-bucket.cn-sh2.ufileos.com/20260205_153025_a3b4c5d6e7f8g9h0.png?...signature...
ℹ️ Note:
- Click to download file directly (not preview)
- URL contains authentication signature (required by US3)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📥 下载链接(7天内有效):
https://my-bucket.cn-sh2.ufileos.com/20260205_153025_a3b4c5d6e7f8g9h0.png?...signature...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
cn-bj.ufileos.comcn-sh2.ufileos.comcn-gd.ufileos.comhk.ufileos.com共 1 个版本