使用方法:本文档定义了所有可用的腾讯微云管理 Skills。AI Agent 或开发者可根据此文档调用 Python 脚本完成云存储操作。
认证方式(二选一):
bash
# Method 1: QR code login (recommended) python weiyun_skills/login.py --method qrcode # Method 2: Copy cookies from browser python weiyun_skills/login.py --method cookies --cookies "uin=o012345678; skey=@abcdef1234; ..."调用方式:
bash
# CLI python weiyun_skills/main.py <command> [args] [options] # Python SDK from weiyun_skills.client import WeiyunClient client = WeiyunClient() client.<skill_name>(**params)统一返回格式:
json
{ "success": true, "data": { ... }, "message": "ok" }
描述:生成腾讯微云登录二维码,用户使用微信/QQ 扫码完成认证。登录成功后自动保存 Cookies 到 cookies.json。
CLI:
bash
python weiyun_skills/login.py --method qrcode
Python:
python
from weiyun_skills.login import qrcode_login
cookies = qrcode_login()
# Terminal will display QR code, scan with WeChat/QQ
# After success, cookies are saved to cookies.json
输入参数:
参数名类型必填默认值说明save_path``string❌cookies.jsonCookies 保存路径
输出参数:
参数名类型说明success``boolean是否登录成功uin``string用户 UINnickname``string用户昵称cookies_str``stringCookies 字符串save_path``stringCookies 保存路径
流程:
text
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Request QR │────▶│ Display QR │────▶│ User scans │
│ code URL │ │ in terminal │ │ with WeChat │
└─────────────┘ └──────────────┘ └──────┬──────┘
│
┌─────────────┐ ┌──────────────┐ │
│ Save to │◀────│ Get cookies │◀────────────┘
│ cookies.json│ │ from server │
└─────────────┘ └──────────────┘
描述:使用从浏览器复制的 Cookies 字符串完成登录认证。
CLI:
bash
python weiyun_skills/login.py --method cookies --cookies "uin=o012345678; skey=@abcdef1234; p_uin=o012345678; pt4_token=xxxxx; p_skey=xxxxx"
Python:
python
from weiyun_skills.login import cookies_login
cookies = cookies_login(
cookies_str="uin=o012345678; skey=@abcdef1234; ..."
)
如何获取 Cookies:
F12 打开开发者工具Network(网络)标签页Headers(请求头)中找到 Cookie 字段输入参数:
参数名类型必填默认值说明cookies_str``string✅-从浏览器复制的 Cookie 字符串save_path``string❌cookies.jsonCookies 保存路径
输出参数:
参数名类型说明success``boolean是否验证成功uin``string用户 UINnickname``string用户昵称save_path``stringCookies 保存路径
描述:列出微云指定目录下的所有文件和文件夹。
CLI:
bash
python weiyun_skills/main.py list /
python weiyun_skills/main.py list /我的文档 --sort size --order desc
Python:
python
files = client.list_files("/我的文档", sort_by="size", sort_order="desc")
输入参数:
参数名类型必填默认值说明remote_path``string❌/目录路径,默认根目录sort_by``string❌name排序字段: name/ size/ time``sort_order``string❌asc排序方向: asc/ desc``page``integer❌1分页页码page_size``integer❌100每页数量
输出参数:
参数名类型说明files``array文件列表files[].file_id``string文件唯一 IDfiles[].name``string文件名files[].type``string``file 或 folder``files[].size``integer大小(字节)files[].size_str``string可读大小(如 2.5 MB)files[].path``string完整路径files[].updated_at``string最后修改时间total``integer总数量
示例输出:
json
{
"success": true,
"data": {
"files": [
{
"file_id": "f_abc123",
"name": "report.pdf",
"type": "file",
"size": 2621440,
"size_str": "2.5 MB",
"path": "/我的文档/report.pdf",
"updated_at": "2026-03-15 10:30:00"
},
{
"file_id": "d_folder01",
"name": "照片",
"type": "folder",
"size": 0,
"size_str": "-",
"path": "/我的文档/照片",
"updated_at": "2026-03-14 08:00:00"
}
],
"total": 2
},
"message": "ok"
}
描述:将本地文件上传到微云指定目录。支持大文件分片上传。
CLI:
bash
python weiyun_skills/main.py upload ./report.pdf /我的文档/
python weiyun_skills/main.py upload ./big_video.mp4 /视频/ --overwrite
Python:
python
result = client.upload_file("./report.pdf", "/我的文档/report.pdf", overwrite=True)
输入参数:
参数名类型必填默认值说明local_path``string✅-本地文件路径remote_path``string✅-微云目标路径overwrite``boolean❌false是否覆盖同名文件
输出参数:
参数名类型说明file_id``string上传后的文件 IDname``string文件名size``integer文件大小remote_path``string云端路径md5``string文件 MD5uploaded_at``string上传时间
描述:将本地文件夹递归上传到微云,自动创建对应的目录结构。跳过隐藏文件和 __pycache__ 等缓存目录。
CLI:
bash
# Upload folder to Weiyun root
python weiyun_skills/main.py upload-folder ./my_docs/
# Upload folder to a specific remote directory
python weiyun_skills/main.py upload-folder ./my_docs/ /目标文件夹/
# Overwrite existing files
python weiyun_skills/main.py upload-folder ./my_docs/ / --overwrite
Python:
python
# Upload to root
result = client.upload_folder("./my_docs/")
# Upload to a specific folder, overwrite existing
result = client.upload_folder("./my_docs/", remote_path="/目标文件夹/", overwrite=True)
输入参数:
参数名类型必填默认值说明local_path``string✅-本地文件夹路径remote_path``string❌/微云目标路径( / 表示根目录)overwrite``boolean❌false是否覆盖同名文件
输出参数:
参数名类型说明folder_name``string上传的文件夹名称uploaded_files``array成功上传的文件列表uploaded_files[].name``string文件名uploaded_files[].size``integer文件大小(字节)uploaded_files[].size_str``string可读大小uploaded_files[].instant_upload``boolean是否秒传failed_files``array上传失败的文件列表failed_files[].name``string文件名failed_files[].error``string错误信息uploaded_count``integer成功上传数量failed_count``integer失败数量total_size_str``string总上传大小elapsed``float上传耗时(秒)
示例输出:
json
{
"success": true,
"data": {
"folder_name": "upload_file",
"uploaded_files": [
{
"name": "abc.txt",
"size": 6,
"size_str": "6.00 B",
"instant_upload": false
}
],
"failed_files": [],
"uploaded_count": 1,
"failed_count": 0,
"total_size_str": "6.00 B",
"elapsed": 2.35
},
"message": "ok"
}
描述:从微云下载文件到本地。
CLI:
bash
python weiyun_skills/main.py download /我的文档/report.pdf ./downloads/
python weiyun_skills/main.py download /我的文档/report.pdf ./downloads/ --overwrite
Python:
python
result = client.download_file("/我的文档/report.pdf", "./downloads/report.pdf")
输入参数:
参数名类型必填默认值说明remote_path``string✅-微云文件路径local_path``string✅-本地保存路径overwrite``boolean❌false是否覆盖本地文件
输出参数:
参数名类型说明local_path``string本地保存路径size``integer文件大小md5``stringMD5 校验值elapsed``float下载耗时(秒)
描述:从微云下载整个文件夹到本地。支持两种模式:递归下载(保留目录结构)和打包下载(下载为 zip 文件)。
CLI:
bash
# Recursive download (preserves folder structure)
python weiyun_skills/main.py download-folder QQ ./downloads/
python weiyun_skills/main.py download-folder QQ ./downloads/ --overwrite
# Download as zip
python weiyun_skills/main.py download-folder QQ ./downloads/ --zip
Python:
python
# Recursive download
result = client.download_folder("QQ", "./downloads/")
# Download as zip
result = client.download_folder("QQ", "./downloads/", as_zip=True)
输入参数:
参数名类型必填默认值说明folder_name``string✅-微云上的文件夹名称local_path``string✅-本地保存目录(或 zip 文件路径)overwrite``boolean❌false是否覆盖已存在的本地文件as_zip``boolean❌false是否打包为 zip 下载
输出参数(递归模式):
参数名类型说明folder_name``string文件夹名称local_path``string本地保存路径downloaded_files``array成功下载的文件列表downloaded_files[].name``string文件名downloaded_files[].local_path``string本地路径downloaded_files[].size``integer文件大小(字节)downloaded_files[].size_str``string可读大小failed_files``array下载失败的文件列表failed_files[].name``string文件名failed_files[].error``string错误信息downloaded_count``integer成功下载数量failed_count``integer失败数量total_size_str``string总下载大小elapsed``float下载耗时(秒)
输出参数(zip 模式):
参数名类型说明local_path``stringzip 文件本地路径size``integer文件大小(字节)size_str``string可读大小md5``stringMD5 校验值elapsed``float下载耗时(秒)
示例输出(递归模式):
json
{
"success": true,
"data": {
"folder_name": "QQ",
"local_path": "./downloads/QQ",
"downloaded_files": [
{
"name": "report.pdf",
"local_path": "./downloads/QQ/report.pdf",
"size": 8663503,
"size_str": "8.26 MB"
}
],
"failed_files": [],
"downloaded_count": 6,
"failed_count": 0,
"total_size_str": "33.11 MB",
"elapsed": 5.88
},
"message": "ok"
}
描述:删除微云文件或文件夹(移入回收站)。
CLI:
bash
python weiyun_skills/main.py delete /我的文档/old_file.pdf
python weiyun_skills/main.py delete /我的文档/old_file.pdf --permanent
Python:
python
result = client.delete_file("/我的文档/old_file.pdf", permanent=False)
输入参数:
参数名类型必填默认值说明remote_path``string✅-文件/文件夹路径permanent``boolean❌false是否永久删除(跳过回收站)
输出参数:
参数名类型说明deleted_path``string已删除的路径is_permanent``boolean是否永久删除deleted_at``string删除时间
描述:将文件或文件夹移动到另一个目录。
CLI:
bash
python weiyun_skills/main.py move /我的文档/report.pdf /归档/2026/
Python:
python
result = client.move_file("/我的文档/report.pdf", "/归档/2026/")
输入参数:
参数名类型必填默认值说明source_path``string✅-源路径target_path``string✅-目标目录路径
输出参数:
参数名类型说明source_path``string原路径target_path``string新路径
描述:复制文件或文件夹到另一个目录。
CLI:
bash
python weiyun_skills/main.py copy /我的文档/report.pdf /备份/
Python:
python
result = client.copy_file("/我的文档/report.pdf", "/备份/")
输入参数:
参数名类型必填默认值说明source_path``string✅-源路径target_path``string✅-目标目录路径
输出参数:
参数名类型说明source_path``string源路径target_path``string副本路径new_file_id``string副本文件 ID
描述:重命名文件或文件夹。
CLI:
bash
python weiyun_skills/main.py rename /我的文档/report.pdf "年度报告.pdf"
Python:
python
result = client.rename_file("/我的文档/report.pdf", "年度报告.pdf")
输入参数:
参数名类型必填默认值说明remote_path``string✅-文件当前路径new_name``string✅-新文件名
输出参数:
参数名类型说明old_path``string原路径new_path``string新路径
描述:在微云上创建文件夹,支持递归创建多级目录。
CLI:
bash
python weiyun_skills/main.py mkdir /工作/2026/Q1/报告
Python:
python
result = client.create_folder("/工作/2026/Q1/报告")
输入参数:
参数名类型必填默认值说明remote_path``string✅-文件夹路径
输出参数:
参数名类型说明folder_id``string文件夹 IDpath``string完整路径created_at``string创建时间
描述:按关键词搜索微云中的文件。
CLI:
bash
python weiyun_skills/main.py search "报告"
python weiyun_skills/main.py search "报告" --type document
Python:
python
results = client.search_files("报告", file_type="document")
输入参数:
参数名类型必填默认值说明keyword``string✅-搜索关键词file_type``string❌all类型过滤: all/ document/ image/ video/ audio``page``integer❌1分页页码page_size``integer❌50每页数量
输出参数:
参数名类型说明results``array搜索结果列表results[].file_id``string文件 IDresults[].name``string文件名results[].type``string类型results[].size_str``string可读大小results[].path``string路径total``integer匹配总数
描述:为文件或文件夹创建分享链接,支持设置密码和有效期。
CLI:
bash
python weiyun_skills/main.py share /我的文档/report.pdf
python weiyun_skills/main.py share /我的文档/report.pdf --expire 7 --password abc1
Python:
python
share = client.create_share(
"/我的文档/report.pdf",
expire_days=7,
password="abc1"
)
print(share["share_url"])
输入参数:
参数名类型必填默认值说明remote_path``string✅-文件/文件夹路径password``string❌null分享密码(4 位)expire_days``integer❌0有效天数,0 为永久
输出参数:
参数名类型说明share_id``string分享 IDshare_url``string分享链接password``string分享密码expire_at``string过期时间created_at``string创建时间
示例输出:
json
{
"success": true,
"data": {
"share_id": "s_abc123",
"share_url": "https://share.weiyun.com/xxxx",
"password": "abc1",
"expire_at": "2026-03-22 21:00:00",
"created_at": "2026-03-15 21:00:00"
},
"message": "ok"
}
描述:取消已创建的分享链接。
CLI:
bash
python weiyun_skills/main.py unshare s_abc123
Python:
python
result = client.cancel_share("s_abc123")
输入参数:
参数名类型必填默认值说明share_id``string✅-分享 ID
输出参数:
参数名类型说明share_id``string已取消的分享 IDcancelled_at``string取消时间
描述:列出当前用户所有的分享链接。
CLI:
bash
python weiyun_skills/main.py shares
python weiyun_skills/main.py shares --status active
Python:
python
shares = client.list_shares(status="active")
输入参数:
参数名类型必填默认值说明status``string❌all状态过滤: all/ active/ expired``page``integer❌1分页页码page_size``integer❌20每页数量
输出参数:
参数名类型说明shares``array分享列表shares[].share_id``string分享 IDshares[].share_url``string分享链接shares[].file_name``string文件名shares[].status``string状态shares[].view_count``integer查看次数shares[].download_count``integer下载次数shares[].created_at``string创建时间shares[].expire_at``string过期时间total``integer总数量
描述:获取微云存储空间使用情况。
CLI:
bash
python weiyun_skills/main.py space
Python:
python
info = client.get_space_info()
print(f"Used: {info['used_space_str']} / {info['total_space_str']}")
输入参数:无
输出参数:
参数名类型说明total_space``integer总空间(字节)total_space_str``string可读总空间(如 10 GB)used_space``integer已用空间(字节)used_space_str``string可读已用空间free_space``integer剩余空间(字节)free_space_str``string可读剩余空间usage_percent``float使用百分比file_count``integer文件总数folder_count``integer文件夹总数
示例输出:
json
{
"success": true,
"data": {
"total_space": 10737418240,
"total_space_str": "10.00 GB",
"used_space": 5368709120,
"used_space_str": "5.00 GB",
"free_space": 5368709120,
"free_space_str": "5.00 GB",
"usage_percent": 50.0,
"file_count": 1234,
"folder_count": 56
},
"message": "ok"
}
描述:获取回收站中的文件列表。
CLI:
bash
python weiyun_skills/main.py recycle
Python:
python
items = client.get_recycle_bin()
输入参数:
参数名类型必填默认值说明page``integer❌1分页页码page_size``integer❌50每页数量
输出参数:
参数名类型说明files``array回收站文件列表files[].file_id``string文件 IDfiles[].name``string文件名files[].size_str``string可读大小files[].original_path``string原始路径files[].deleted_at``string删除时间total``integer总数量total_size_str``string回收站总大小
描述:从回收站恢复文件到原始位置。
CLI:
bash
python weiyun_skills/main.py restore f_del001
Python:
python
result = client.restore_file("f_del001")
输入参数:
参数名类型必填默认值说明file_id``string✅-回收站中的文件 ID
输出参数:
参数名类型说明file_id``string文件 IDrestored_path``string恢复后路径restored_at``string恢复时间
描述:清空回收站,永久删除所有回收站文件。 ⚠️ 此操作不可逆!
CLI:
bash
python weiyun_skills/main.py clear-recycle --confirm
Python:
python
result = client.clear_recycle_bin(confirm=True)
输入参数:
参数名类型必填默认值说明confirm``boolean✅-必须为 true 才执行
输出参数:
参数名类型说明deleted_count``integer删除文件数freed_space_str``string释放的空间大小cleared_at``string清空时间
错误码说明AUTH_EXPIREDCookies 已过期,需重新登录AUTH_FAILED认证失败FILE_NOT_FOUND文件不存在FOLDER_NOT_FOUND文件夹不存在SPACE_FULL空间已满FILE_TOO_LARGE文件过大DUPLICATE_NAME名称重复PERMISSION_DENIED权限不足RATE_LIMITED请求频率超限NETWORK_ERROR网络错误SHARE_EXPIRED分享已过期INVALID_PARAM参数无效QR_EXPIRED二维码已过期,需刷新QR_CANCELLED用户取消了扫码
错误响应格式:
json
{
"success": false,
"data": null,
"message": "Cookies expired, please re-login",
"error_code": "AUTH_EXPIRED"
}
Cookie 名称说明uin用户 QQ 号标识skey会话密钥p_uin加密的用户标识p_skey加密的会话密钥pt4_tokenPT4 认证 Tokenpt2gguin辅助认证字段
提示:并非所有 Cookie 字段都是必需的,核心字段为
uin、skey、p_skey。