返回顶部
t

tencent-cos-uploader

使用腾讯云 COS Python SDK 上传指定本地文件到目标 Bucket,并生成可用于查看和下载的预签名访问链接。用户提到 COS、对象存储、Bucket、上传文件、临时分享链接、签名 URL、下载直链时使用此 skill。

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.0
安全检测
已通过
87
下载量
0
收藏
概述
安装方式
版本历史

tencent-cos-uploader

# Tencent COS Uploader ## Overview Use Tencent COS Python SDK to upload a local file and return presigned URLs for browser preview and file download. ## Prerequisites 1. Install dependency: ```bash pip install cos-python-sdk-v5 ``` 2. Prepare COS credentials (env vars preferred): - `COS_SECRET_ID` - `COS_SECRET_KEY` - `COS_REGION` - `COS_BUCKET` - `COS_SESSION_TOKEN` (optional, for temporary credentials) ## Workflow 1. Confirm required inputs: - `region` (from `--region` or env) - `bucket` (from `--bucket` or env) - `--file` local file path - `--key` object key in bucket (default is filename) 2. Run the script: ```bash python3 scripts/cos_upload_and_presign.py \ --region ap-guangzhou \ --bucket my-bucket-1250000000 \ --file /absolute/path/to/file.pdf \ --key reports/2026/file.pdf \ --expires 3600 ``` 3. Return JSON output containing: - `view_url`: GET presigned URL for viewing - `download_url`: presigned URL with `attachment` disposition - `upload_result`: SDK upload response ## Script Parameters - `--region` COS region, optional if `COS_REGION` exists - `--bucket` bucket name with appid suffix, optional if `COS_BUCKET` exists - `--file` local file path to upload, required - `--key` object key in bucket, optional - `--expires` URL expiration seconds, default `3600` - `--secret-id` optional if `COS_SECRET_ID` exists - `--secret-key` optional if `COS_SECRET_KEY` exists - `--session-token` optional if `COS_SESSION_TOKEN` exists - `--scheme` `https` or `http`, default `https` - `--download-filename` custom filename for download prompt (optional) ## Notes - Keep `expires` as short as practical to reduce link leakage risk. - `download_url` is generated via `get_presigned_download_url`; `view_url` is generated via `get_presigned_url(Method='GET')`. - If `--key` is omitted, the script uses the source filename as object key.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 tencent-cos-uploader-1776024929 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 tencent-cos-uploader-1776024929 技能

通过命令行安装

skillhub install tencent-cos-uploader-1776024929

下载 Zip 包

⬇ 下载 tencent-cos-uploader v0.1.0

文件大小: 4.2 KB | 发布时间: 2026-4-13 12:18

v0.1.0 最新 2026-4-13 12:18
Initial release: upload file to COS and generate presigned view/download URLs; support COS_* env vars.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部