client#
此模块包含了客户端操作的基本封装
- class p123client.client.P123Client(passport: int | str | PathLike = '', password: str = '', token: None | str | PathLike = None, client_id: str = '', client_secret: str = '', refresh_token: str = '', check_for_relogin: bool = True)[source]#
Bases:
P123OpenClient123 的客户端对象
Caution
优先级为:token > passport+password > refresh_token > client_id+client_secret > 扫码
使用 refresh_token(或者说 oauth 登录),只允许访问 open 接口
- Parameters:
passport – 手机号或邮箱
password – 密码
token – 123 的访问令牌
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
refresh_token – 刷新令牌
- app_config(payload: dict | str = 'OfflineDownload', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- app_config(payload: dict | str = 'OfflineDownload', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取配置信息
POST https://www.123pan.com/api/config/get
- Payload:
business_key: str 💡 配置键名(字段)
- static app_dydomain(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static app_dydomain(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取 123 网盘的各种域名
- static app_id_get(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static app_id_get(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取 app-id
- app_permission_delete(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- app_permission_delete(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
第三方挂载工具登录授权列表
DELETE https://www.123pan.com/api/restful/goapi/v1/oauth2/app_permission
- Payload:
appId: str 💡 应用 id,也就是
client_id
- app_permission_list(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- app_permission_list(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
第三方挂载工具登录授权列表
GET https://www.123pan.com/api/restful/goapi/v1/oauth2/app_permission/list
- Payload:
page: int = 1 💡 第几页
pageSize: int = 100 💡 分页大小
- static app_server_time(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static app_server_time(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取 123 网盘的服务器时间戳
- static app_transfer_metrics(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static app_transfer_metrics(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取和传输有关的配置信息
GET https://www.123pan.com/api/transfer/metrics/whether/report
- dlink_disable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_disable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
禁用直链空间
POST https://www.123pan.com/api/cdn-link/disable
- Payload:
fileID: int | str 💡 目录 id
- dlink_enable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_enable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
启用直链空间
POST https://www.123pan.com/api/cdn-link/enable
- Payload:
fileID: int | str 💡 目录 id
- dlink_url(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_url(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取直链链接
GET https://www.123pan.com/api/cdn-link/url
- Payload:
fileID: int | str 💡 文件 id
- download_info(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- download_info(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取下载信息
POST https://www.123pan.com/api/file/download_info
Hint
即使文件已经被删除,只要还有 S3KeyFlag 和 Etag (即 MD5) 就依然可以下载
你完全可以构造这样的查询参数
payload = { "Etag": "...", # 必填,文件的 MD5 "FileID": 0, # 可以随便填 "FileName": "a", # 随便填一个名字 "S3KeyFlag": str # 必填,格式为 f"{UID}-0",UID 就是上传此文件的用户的 UID,如果此文件是由你上传的,则可从 ``P123Client.user_info`` 的响应中获取 "Size": 0, # 可以随便填,填了可能搜索更准确 }
Note
获取的直链有效期是 24 小时
- Payload:
Etag: str 💡 文件的 MD5 散列值
S3KeyFlag: str
FileName: str = <default> 💡 默认用 Etag(即 MD5)作为文件名
FileID: int | str = 0
Size: int = <default>
Type: int = 0
driveId: int | str = 0
…
- download_info_batch(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- download_info_batch(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取批量下载信息
POST https://www.123pan.com/api/file/batch_download_info
Attention
会把一些文件或目录以 zip 包的形式下载,但非会员有流量限制,所以还是推荐用
P123Client.download_info逐个获取下载链接并下载- Payload:
fileIdList: list[FileID]
FileID = { "FileId": int | str }
- download_url(payload: dict | int | str | tuple[str, int] | tuple[str, int, str], /, *, async_: Literal[False] = False, **request_kwargs) str[source]#
- download_url(payload: dict | int | str | tuple[str, int] | tuple[str, int, str], /, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, str]
获取下载链接
Note
payload支持多种格式的输入,按下面的规则按顺序进行判断:如果是
int或str,则视为文件 id,必须在你的网盘中存在此文件如果是
tuple[str, int],视为 (“Etag” 或者文件的sha1, “Size”) 的组合,则会先秒传(临时文件路径为 /.tempfile)再获取链接,文件不必在你网盘中如果是
tuple[str, int, str],视为 (“Etag”, “Size”, “S3KeyFlag”) 的组合,则直接获取链接,文件不必在你网盘中如果是
dict(不区分大小写),有 “S3KeyFlag”, “Etag” 和 “Size” 的值,则直接获取链接,文件不必在你网盘中如果是
dict(不区分大小写),有 “Etag” 和 “Size” 的值,则会先秒传(临时文件路径为 /.tempfile)再获取链接,文件不必在你网盘中如果是
dict(不区分大小写),有 “FileID”,则会先获取信息,再获取链接,必须在你的网盘中存在此文件否则会报错 ValueError
- Parameters:
payload –
文件 id 或者文件信息,文件信息必须包含的信息如下:
FileID: int | str 💡 下载链接
S3KeyFlag: str 💡 s3 存储名
Etag: str 💡 文件的 MD5 散列值
Size: int 💡 文件大小
FileName: str 💡 默认用 Etag(即 MD5)作为文件名,可以省略
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
下载链接
- fs_abnormal_count(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_abnormal_count(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取异常文件数
- fs_archive_list(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_archive_list(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
推送【云解压】任务
GET https://www.123pan.com/api/restful/goapi/v1/archive/file/list
Note
后台异步执行,任务结果请从
client.fs_archive_status()接口获取- Payload:
fileId: int | str 💡 压缩包的文件 id
password: int | str = “” 💡 解压密码
- fs_archive_status(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_archive_status(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
推送云解压任务
GET https://www.123pan.com/api/restful/goapi/v1/archive/file/status
Note
响应结果中包含 “state” 字段,具体含义为
0: 未运行或不存在
1: 运行中
2: 成功
3: 失败
- Payload:
fileId: int | str 💡 压缩包的文件 id
taskId: int | str 💡 任务 id
taskType: int = <default> 💡 任务类型。目前已知:1:云解压 2:解压到
- fs_archive_uncompress(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_archive_uncompress(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
推送【解压到】任务
POST https://www.123pan.com/api/restful/goapi/v1/archive/file/uncompress
- Payload:
fileId: int | str 💡 压缩包的文件 id
password: int | str = “” 💡 解压密码
targetFileId: int | str = 0 💡 保存到的目录 id
taskId: int 💡 任务 id
list: list[FileInfo] 💡 选择要解压的文件列表,信息来自
client.fs_archive_status()接口的响应FileInfo: { "fontId": str, "fileName": str, "parentFile": str, "filePath": str, "fileSize": int, "fileType": 0 | 1, "createTime": str, "category": int, "childFiles": None | list[FileInfo], }
- fs_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
复制
POST https://www.123pan.com/api/restful/goapi/v1/file/copy/async
- Payload:
fileList: list[File] 💡 信息可以取自
P123Client.fs_info接口File = { "FileId": int | str, ... }
targetFileId: int | str = 0
- fs_copy_task(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_copy_task(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
复制:任务进度
GET https://www.123pan.com/api/restful/goapi/v1/file/copy/task
- Payload:
taskId: int 💡 任务 id
- fs_delete(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_delete(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
彻底删除
POST https://www.123pan.com/api/file/delete
Hint
彻底删除文件前,文件必须要在回收站中,否则无法删除
- Payload:
fileIdList: list[FileID]
FileID = { "FileId": int | str }
event: str = “recycleDelete”
- fs_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件或目录详情(文件数、目录数、总大小)
GET https://www.123pan.com/api/file/detail
- Payload:
fileID: int | str
- fs_details(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_details(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件或目录详情(文件数、目录数、总大小等)
POST https://www.123pan.com/api/restful/goapi/v1/file/details
- Payload:
file_ids: list[int] 💡 文件或目录的 id 列表
- fs_export_tree(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_export_tree(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
导出目录树
POST https://www.123pan.com/api/restful/goapi/v1/file/export-tree
Caution
单次最多支持导出 100 万条目录数据
- Payload:
fileIds: list[int] 💡 文件或目录的 id 列表
exportLayer: int = 0 💡 导出层级:0-导出全部 n-导出1级到n级
exportName: str = <default> 💡 存储为(文本文件名):默认为 f”目录树_{datetime.datetime.now().strftime(“%FT%T”)}.txt”
exportParentId: int = 0 💡 存储位置
exportStyle: 1 | 2 = 2 💡 导出目录样式:1-目录树 2-目录列表
exportType: 1 | 2 | 3 = 3 💡 导出类型:1-包含文件 2-包含文件夹 3-包含文件和文件夹
treeRootType: 1 | 2 = 1 💡 目录树根:1-当前目录 2-网盘根目录
- fs_get_path(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_get_path(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取某个 id 对应的祖先节点列表
POST https://www.123pan.com/api/file/get_path
Note
随后你可以把这组祖先节点 id 传给
client.fs_info()接口,即可获得具体的节点信息- Payload:
fileId: int 💡 文件 id
- fs_get_path_history(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_get_path_history(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
分别获取一组 id 对应的祖先节点信息(此接口是
client.fs_get_path()的加强版)POST https://www.123pan.com/api/file/get_path_history
- Payload:
fileIdList: list[int]
- fs_info(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_info(payload: dict | int | str | Iterable[int | str] = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件信息
POST https://www.123pan.com/api/file/info
- Payload:
fileIdList: list[FileID]
FileID = { "FileId": int | str }
- fs_list(payload: dict | int | str = 0, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_list(payload: dict | int | str = 0, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件列表(可搜索)
GET https://www.123pan.com/api/file/list
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
Caution
返回信息中的 “Total” 字段固定为 0, 所以获取不了目录内的子节点数
- Payload:
driveId: int | str = 0
limit: int = 100 💡 分页大小,最多 100 个
next: int = 0 💡 下一批拉取开始的 id
orderBy: str = “file_id” 💡 排序依据(⚠️ 不可用,固定等同于 “file_id”)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序(⚠️ 固定等同于 “asc”,且填入 “desc” 会返回空列表)
Page: int = <default> 💡 第几页,从 1 开始,可以是 0(⚠️ 不可用)
parentFileId: int | str = 0 💡 父目录 id
trashed: bool = <default> 💡 是否查看回收站的文件
inDirectSpace: bool = False
event: str = “homeListFile” 💡 事件名称
“homeListFile”: 全部文件
“recycleListFile”: 回收站
“syncFileList”: 同步空间
operateType: int | str = <default> 💡 操作类型,如果在同步空间,则需要指定为 “SyncSpacePage”
SearchData: str = <default> 💡 搜索关键字
OnlyLookAbnormalFile: int = <default>
- fs_list_by_type(payload: dict | int = 1, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_list_by_type(payload: dict | int = 1, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
按类型获取文件列表
GET https://www.123pan.com/api/restful/goapi/v1/file/category/list-by-type
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
Caution
目前,返回信息中并无 “Total” 字段,所以不能直接知道文件总数
- Payload:
driveId: int | str = 0
limit: int = 100 💡 分页大小,最多 100 个
next: int = 0 💡 下一批拉取开始的 id(⚠️ 不可用)
category: int = 1 💡 分类代码
1: 视频
2: 图片
3: 文档
4: 音频
5: 其它
dateGranularity: int = <default> 💡 按时间分组展示
1: 日
2: 月
3: 年
orderBy: str = “file_name” 💡 排序依据
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
Page: int = 1 💡 第几页,从 1 开始
parentFileId: int | str = 0 💡 父目录 id
trashed: bool = <default> 💡 是否查看回收站的文件
inDirectSpace: bool = False
event: str = “homeListFile” 💡 事件名称
“homeListFile”: 全部文件
“recycleListFile”: 回收站
“syncFileList”: 同步空间
operateType: int | str = <default> 💡 操作类型,如果在同步空间,则需要指定为 “SyncSpacePage”
Note
这个值似乎不影响结果,所以可以忽略。我在浏览器中,看到罗列根目录为 1,搜索(指定
SearchData)为 2,同步空间的根目录为 3,罗列其它目录大多为 4,偶尔为 8,也可能是其它值isSearchOrder: bool = <default>
SearchData: str = <default> 💡 搜索关键字
OnlyLookAbnormalFile: int = 0 💡 大概可传入 0 或 1
- fs_list_new(payload: dict | int | str = 0, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_list_new(payload: dict | int | str = 0, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件列表(可搜索)
GET https://www.123pan.com/api/file/list/new
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
- Payload:
driveId: int | str = 0
limit: int = 100 💡 分页大小,最多 100 个(如果 “SearchData” 为空且请求头的 “platform” 字段为 “web”,则固定为 500)
orderBy: str = “file_id” 💡 排序依据
“file_id”: 文件 id,也可以写作 “fileId”
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
“trashed_at”: 删除时间
“remain_days”: 剩余保留天数
“share_id”: 分享 id
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
Page: int = 1 💡 第几页,从 1 开始
parentFileId: int | str = 0 💡 父目录 id
parentFileName: str = <default> 💡 父目录名
trashed: bool = <default> 💡 是否查看回收站的文件
inDirectSpace: bool = False
fileCategory: int = 0 💡 文件类型:0-全部 1-图片 2-视频 3-音频 4-文档 5-文件夹 6-压缩包 7-其它
event: str = “homeListFile” 💡 事件名称
“homeListFile”: 全部文件
“recycleListFile”: 回收站
“syncFileList”: 同步空间
operateType: int | str = <default> 💡 操作类型,如果在同步空间,则需要指定为 “SyncSpacePage”
Note
这个值似乎不影响结果,所以可以忽略。我在浏览器中,看到罗列根目录为 1,搜索(指定
SearchData)为 2,同步空间的根目录为 3,罗列其它目录大多为 4,偶尔为 8,也可能是其它值isSearchOrder: bool = <default>
SearchData: str = <default> 💡 搜索关键字(最多能搜出 1 万条)
OnlyLookAbnormalFile: int = 0 💡 大概可传入 0 或 1
RequestSource: int = <default> 💡 浏览器中,在同步空间中为 1
- fs_mkdir(name: str, /, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_mkdir(name: str, /, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建目录,此接口是
client.upload_request()的封装- Parameters:
name – 目录名
parent_id – 父目录 id
duplicate – 处理同名:0: 复用 1: 保留两者 2: 替换
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- fs_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
移动
POST https://www.123pan.com/api/file/mod_pid
- Payload:
fileIdList: list[FileID]
FileID = { "FileId": int | str }
parentFileId: int | str = 0
event: str = “fileMove”
- fs_refresh(payload: dict = {}, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_refresh(payload: dict = {}, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
刷新列表和直链缓存
POST https://www.123pan.com/api/restful/goapi/v1/cdnLink/cache/refresh
- fs_rename(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_rename(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
(单个)改名
POST https://www.123pan.com/api/file/rename
- Payload:
FileId: int | str
fileName: str
driveId: int | str = 0
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
event: str = “fileRename”
- fs_safe_box_lock(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_safe_box_lock(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
锁定保险箱
POST https://www.123pan.com/api/restful/goapi/v1/file/safe_box/auth/lock
- fs_safe_box_unlock(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_safe_box_unlock(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
解锁保险箱
Note
保险箱的 id,可以用
client.user_info()接口获得,字段为 “SafeBoxFileId”POST https://www.123pan.com/api/restful/goapi/v1/file/safe_box/auth/unlockbox
- Payload:
password: int | str 💡 6 位密码
- fs_star(payload: dict | int | str | Iterable[int | str], /, star: bool = True, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_star(payload: dict | int | str | Iterable[int | str], /, star: bool = True, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
给文件或目录,设置或取消星标(收藏)
POST https://www.123pan.com/api/restful/goapi/v1/file/starred
- Payload:
fileIdList: list[int | str] 💡 id 列表
starredStatus: int = 255 💡 是否设置星标:1:取消 255:设置
- fs_star_list(payload: dict | int = 1, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_star_list(payload: dict | int = 1, /, event: str = 'homeListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
罗列已星标的文件或目录
GET https://www.123pan.com/api/restful/goapi/v1/file/starred/list
- Payload:
driveId: int | str = 0
next: int = 0 💡 下一批拉取开始的 id
orderBy: str = “file_name” 💡 排序依据
“file_id”: 文件 id,也可以写作 “fileId”
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
“trashed_at”: 删除时间
“share_id”: 分享 id
“remain_days”: 剩余保留天数
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
Page: int = 1 💡 第几页,从 1 开始
pageSize: int = 100 💡 分页大小,最多 100 个
parentFileId: int | str = 0 💡 父目录 id
trashed: bool = <default> 💡 是否查看回收站的文件
inDirectSpace: bool = False
fileCategory: int = 0 💡 文件类型:0-全部 1-图片 2-视频 3-音频 4-文档 5-文件夹 6-压缩包 7-其它
event: str = “homeListFile” 💡 事件名称
“homeListFile”: 全部文件
“recycleListFile”: 回收站
“syncFileList”: 同步空间
operateType: int | str = <default> 💡 操作类型,如果在同步空间,则需要指定为 “SyncSpacePage”
Note
这个值似乎不影响结果,所以可以忽略。我在浏览器中,看到罗列根目录为 1,搜索(指定
SearchData)为 2,同步空间的根目录为 3,罗列其它目录大多为 4,偶尔为 8,也可能是其它值isSearchOrder: bool = <default>
SearchData: str = <default> 💡 搜索关键字
OnlyLookAbnormalFile: int = 0 💡 大概可传入 0 或 1
- fs_sync_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_sync_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取同步空间的操作记录
GET https://www.123pan.com/api/restful/goapi/v1/sync-disk/file/log
- Payload:
page: int = 1 💡 第几页
pageSize: int = 100 💡 每页大小
searchData: str = <default> 💡 搜索关键字
- fs_trash(payload: dict | int | str | Iterable[int | str], /, event: str = 'intoRecycle', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_trash(payload: dict | int | str | Iterable[int | str], /, event: str = 'intoRecycle', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
操作回收站
POST https://www.123pan.com/api/file/trash
- Payload:
fileTrashInfoList: list[File] 💡 信息可以取自
P123Client.fs_info接口,也可以仅文件 idFile = { "FileId": int | str, ... }
driveId: int = 0
event: str = “intoRecycle” 💡 事件类型
“intoRecycle”: 移入回收站
“recycleRestore”: 移出回收站
operation: bool = <default>
operatePlace: int = <default>
RequestSource: int = <default> 💡 浏览器中,在同步空间中为 1
safeBox: bool = <default>
- fs_trash_clear(payload: dict = {'event': 'recycleClear'}, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_trash_clear(payload: dict = {'event': 'recycleClear'}, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
清空回收站
POST https://www.123pan.com/api/file/trash_delete_all
- Payload:
event: str = “recycleClear”
- fs_trash_recover_by_path(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_trash_recover_by_path(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
回收站:还原到指定位置
POST https://www.123pan.com/api/file/recover/by_path
- Payload:
fileIds: list[int] 💡 文件或目录的 id 列表
parentFileId: int = 0 💡 父目录 id
- static fs_video_play_conf(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static fs_video_play_conf(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取视频播放列表的配置信息
- fs_video_play_list(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_video_play_list(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取某个目录下的视频列表
GET https://www.123pan.com/api/file/video/play/list
- Payload:
page: int = 1
page_size: int = 100
parent_file_id: int = 0
- fs_webdav_account_create(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_webdav_account_create(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
WebDAV 添加应用
POST https://www.123pan.com/api/restful/goapi/v1/webdav/account/create
Caution
密码不能自己设置,只会自动生成
- Payload:
app: str 💡 应用名字
- fs_webdav_account_delete(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_webdav_account_delete(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
WebDAV 删除应用(解除授权)
GET https://www.123pan.com/api/restful/goapi/v1/webdav/account/del
- Payload:
id: int | str 💡 应用 id
- fs_webdav_account_list(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_webdav_account_list(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
WebDAV 授权列表
GET https://www.123pan.com/api/restful/goapi/v1/webdav/account/list
- login(passport: int | str = '', password: str = '', client_id: str = '', client_secret: str = '', refresh_token: str = '', remember: bool = True, platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login(passport: int | str = '', password: str = '', client_id: str = '', client_secret: str = '', refresh_token: str = '', remember: bool = True, platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
登录以获取 access_token
- Parameters:
passport – 账号
password – 密码
remember – 是否记住密码(不用管)
platform – 用哪个设备平台扫码
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口的响应信息
- login_another(replace: bool | Self = False, platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) Self[source]#
- login_another(replace: bool | Self = False, platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]
再执行一次登录
- Parameters:
replace –
替换某个 client 对象的 token
如果为 P123Client, 则更新到此对象
如果为 True,则更新到 self`
如果为 False,否则返回新的
P123Client对象
platform – 用哪个设备平台扫码
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
客户端实例
- static login_passport(payload: dict, /, request: None | Callable = None, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_passport(payload: dict, /, request: None | Callable = None, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
使用账号和密码登录
POST https://www.123pan.com/api/user/sign_in
Note
获取的 token 有效期 30 天
- Payload:
passport: int | str 💡 手机号或邮箱
password: str 💡 密码
remember: bool = True 💡 是否记住密码(不用管)
- login_qrcode_auto(platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login_qrcode_auto(platform: int = 0, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
执行一次自动扫码,但并不因此更新
self.tokenCaution
非会员目前只支持同时在线 3 台登录设备,VIP 则支持同时在线 10 台
- Parameters:
platform – 用哪个设备平台扫码
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- static login_qrcode_bind_wx_code(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_qrcode_bind_wx_code(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
绑定微信号
POST https://login.123pan.com/api/user/qr-code/bind_wx_code
- Payload:
uniID: str 💡 二维码 id
wxcode: str 💡 微信码
- login_qrcode_confirm(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login_qrcode_confirm(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
确认扫码登录
POST https://login.123pan.com/api/user/qr-code/login
- Payload:
uniID: str 💡 二维码 id
- static login_qrcode_deny(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_qrcode_deny(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
更新扫码状态为:已取消(loginStatus=2)
POST https://login.123pan.com/api/user/qr-code/deny
- Payload:
uniID: str 💡 二维码 id
- static login_qrcode_generate(base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_qrcode_generate(base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
产生二维码
- static login_qrcode_result(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_qrcode_result(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取扫码结果
GET https://login.123pan.com/api/user/qr-code/result
Note
返回值中有个 “loginStatus” 字段,值为数字,分别表示的意思为:
0: 等待扫码
1: 已扫码
2: 已取消
3: 已登录
4: 已失效
- Payload:
uniID: str 💡 二维码 id
- static login_qrcode_scan(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_qrcode_scan(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
更新扫码状态为:已扫码(loginStatus=1)
POST https://login.123pan.com/api/user/qr-code/scan
- Payload:
uniID: str 💡 二维码 id
scanPlatform: int = 0 💡 扫码的平台代码,部分已知:4:微信 7:android
- classmethod login_with_qrcode(base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- classmethod login_with_qrcode(base_url: str | Callable[[], str] = DEFAULT_LOGIN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
二维码扫码登录
- Parameters:
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- logout(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- logout(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
退出登录
- offline_add(url: str | Iterable[str], upload_dir: None | int | str = None, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_add(url: str | Iterable[str], upload_dir: None | int | str = None, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
添加离线下载任务
POST https://www.123pan.com/api/offline_download/upload/seed
- param url:
info_hash(只允许单个)、下载链接(多个用 “
- “ 分隔)或者多个下载链接的迭代器
- param upload_dir:
保存到目录的 id
- param base_url:
API 链接的基地址
- param async_:
是否异步
- param request_kwargs:
其它请求参数
- return:
接口响应信息
- offline_task_abort(payload: int | Iterable[int] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_abort(payload: int | Iterable[int] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
取消离线下载任务
POST https://www.123pan.com/api/offline_download/task/abort
- Payload:
task_ids: list[int] 💡 任务 id 列表
is_abort: bool = True 💡 是否取消
all: bool = False 💡 是否全部
- offline_task_delete(payload: int | Iterable[int] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_delete(payload: int | Iterable[int] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
删除离线下载任务
POST https://www.123pan.com/api/offline_download/task/delete
- Payload:
task_ids: list[int] 💡 任务 id 列表
status_arr: list[ 0 | 1 | 2 | 3 | 4 ] = [] 💡 状态列表:0:进行中 1:下载失败 2:下载成功 3:重试中
- offline_task_list(payload: dict | int | list[int] | tuple[int] = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_list(payload: dict | int | list[int] | tuple[int] = 1, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
离线下载任务列表
POST https://www.123pan.com/api/offline_download/task/list
- Payload:
current_page: int = 1
page_size: 100
status_arr: list[ 0 | 1 | 2 | 3 | 4 ] = [0, 1, 2, 3, 4] 💡 状态列表:0:进行中 1:下载失败 2:下载成功 3:重试中 4:等待中
- offline_task_resolve(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_resolve(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
解析下载链接
POST https://www.123pan.com/api/v2/offline_download/task/resolve
- Payload:
urls: str = <default> 💡 下载链接,多个用 “n” 隔开(用于新建链接下载任务)
info_hash: str = <default> 💡 种子文件的 info_hash(用于新建BT任务)
- offline_task_status(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_status(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
离线下载速度等信息
POST https://www.123pan.com/api/offline_download/task/status
- offline_task_submit(payload: dict | Iterable[dict], /, upload_dir: None | int | str = None, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_submit(payload: dict | Iterable[dict], /, upload_dir: None | int | str = None, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
提交离线下载任务
POST https://www.123pan.com/api/v2/offline_download/task/submit
Note
提交信息来自
client.offline_task_resolve()接口的响应,假设响应为resp,那么payload = { "resource_list": [{ "resource_id": resource["id"], "select_file_id": [info["id"] for info in resource["files"]], } for resource in resp["data"]["list"]] }
- Payload:
resource_list: list[Task] 💡 资源列表
File = { "resource_id": int, # 资源 id "select_file_id": list[int], # 此资源内的文件 id }
upload_dir: int 💡 保存到目录的 id
- offline_task_upload_seed(file: Buffer | SupportsRead[Buffer] | Iterable[Buffer], base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_task_upload_seed(file: Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传种子,以作解析
POST https://www.123pan.com/api/offline_download/upload/seed
- share_cancel(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
取消分享
POST https://www.123pan.com/api/share/delete
- Payload:
shareInfoList: list[ShareID] 💡 信息可以取自
P123Client.fs_info接口ShareID = { "shareId": int | str, }
driveId: int = 0
event: str = “shareCancel” 💡 事件类型
isPayShare: bool = False 💡 是否付费分享
- share_clear(payload: dict = {'event': 'shareClear'}, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
清理全部失效链接
GET https://www.123pan.com/api/share/clean_expire
- Payload:
event: str = “shareClear”
- share_commission_set(payload: dict | int | str | Iterable[int | str], /, amount: int = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
分佣设置
POST https://www.123pan.com/api/share/update
- Payload:
shareIds: int | str 💡 分享 id,多个用 “,” 隔开
noLoginStdAmount: int = 0 💡 文件体积单价(如果为 0 则是关闭),单位:1 分钱
- share_create(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建分享
POST https://www.123pan.com/api/share/create
- Payload:
fileIdList: int | str 💡 文件或目录的 id,多个用逗号 “,” 分隔
displayStatus: int = 2 💡 默认展示:1:平铺 2:列表
driveId: int = 0
event: str = “shareCreate” 💡 事件类型
expiration: “9999-12-31T23:59:59+08:00” 💡 有效期,日期用 ISO 格式
fileNum: int = <default> 💡 文件数
fillPwdSwitch: 0 | 1 = 1 💡 是否自动填充提取码
isPayShare: bool = False 💡 是否付费分享
isReward: 0 | 1 = 0 💡 是否开启打赏
payAmount: int = 0 💡 付费金额,单位:分
renameVisible: bool = False
resourceDesc: str = “” 💡 资源描述
shareModality: int = <default>
shareName: str = <default> 💡 分享名称
sharePwd: str = “” 💡 提取码(不区分大小写)
trafficLimit: int = 0 💡 流量限制额度,单位字节
trafficLimitSwitch: 1 | 2 = 1 💡 是否开启流量限制:1:关闭 2:开启
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_download_info(payload: None | dict = None, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取分享中的下载信息
POST https://www.123pan.com/api/share/download/info
Note
可以作为 staticmethod 使用,此时第 1 个位置参数要传入 None 或者 dict
如果文件在 100MB 以内,下载时是不需要登录的;如果超过 100 MB,但分享者设置的免登录流量包未告罄,下载时也不需要登录
你也可以使用
P123Client.download_info来获取下载链接,则不需要提供 “ShareKey” 和 “SharePwd”- Payload:
ShareKey: str 💡 分享码
SharePwd: str = <default> 💡 提取码(不区分大小写)
Etag: str
S3KeyFlag: str
FileID: int | str
Size: int = <default>
…
- share_download_info_batch(payload: None | dict = None, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取分享中的批量下载信息
POST https://www.123pan.com/api/file/batch_download_share_info
Note
可以作为 staticmethod 使用,此时第 1 个位置参数要传入 None 或者 dict
- Payload:
ShareKey: str 💡 分享码
SharePwd: str = <default> 💡 提取码(不区分大小写)
fileIdList: list[FileID]
FileID = { "FileId": int | str }
- share_fs_copy(payload: dict, /, parent_id: None | int | str = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
转存
POST https://www.123pan.com/api/file/copy/async
Caution
这个函数的字段名,使用 snake case,而不是 camel case
- Payload:
share_key: str 💡 分享码
share_pwd: str = <default> 💡 密码,如果没有就不用传
current_level: int = 1
event: str = “transfer”
file_list: list[File]
File = { "file_id": int | str, "file_name": str, "etag": str, "parent_file_id": int | str = 0, "drive_id": int | str = 0, ... }
- share_fs_list(payload: None | dict = None, /, request: None | Callable = None, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取分享中的文件列表
GET https://www.123pan.com/api/share/get
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
Note
有个 Bug,如果
parentFileId是你网盘中的某个目录的 id,则总是能拉取到,即便不在此分享中- Payload:
ShareKey: str 💡 分享码
SharePwd: str = <default> 💡 提取码(不区分大小写)
limit: int = 100 💡 分页大小,最多 100 个
next: int = 0 💡 下一批拉取开始的 id(⚠️ 不可用)
orderBy: str = “file_name” 💡 排序依据
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
Page: int = 1 💡 第几页,从 1 开始,可以是 0
parentFileId: int | str = 0 💡 父目录 id
event: str = “homeListFile” 💡 事件名称
operateType: int | str = <default> 💡 操作类型
- share_list(payload: dict | int = 1, /, event: str = 'shareListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取免费分享列表(可搜索)
GET https://www.123pan.com/api/share/list
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
- Payload:
driveId: int | str = 0
limit: int = 100 💡 分页大小,最多 100 个
next: int = 0 💡 下一批拉取开始的 id
orderBy: str = “fileId” 💡 排序依据:”fileId”, …
orderDirection: “asc” | “desc” = “desc” 💡 排序顺序
Page: int = <default> 💡 第几页,从 1 开始,可以是 0
event: str = “shareListFile”
operateType: int | str = <default>
SearchData: str = <default> 💡 搜索关键字
- share_payment_list(payload: dict | int = 1, /, event: str = 'shareListFile', base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取付费分享列表(可搜索)
GET https://www.123pan.com/api/restful/goapi/v1/share/content/payment/list
Note
如果返回信息中,”Next” 字段的值为 “-1”,代表最后一页(无需再翻页查询)
- Payload:
driveId: int | str = 0
limit: int = 100 💡 分页大小,最多 100 个
next: int = 0 💡 下一批拉取开始的 id
orderBy: str = “fileId” 💡 排序依据:”fileId”, …
orderDirection: “asc” | “desc” = “desc” 💡 排序顺序
Page: int = <default> 💡 第几页,从 1 开始,可以是 0
event: str = “shareListFile”
operateType: int | str = <default>
SearchData: str = <default> 💡 搜索关键字
- share_reward_set(payload: dict | int | str | Iterable[int | str], /, is_reward: bool = False, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
开启或关闭打赏
POST https://www.123pan.com/api/restful/goapi/v1/share/reward/status
- Payload:
ids: list[int | str] 💡 分享 id
isReward: 0 | 1 = 1 💡 是否开启打赏
- share_traffic(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
分享提取流量包的信息
- share_traffic_set(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
流量包设置
PUT https://www.123pan.com/api/restful/goapi/v1/share/info
- Payload:
shareId: int | str
trafficLimit: int = <default> 💡 流量限制额度,单位字节
trafficLimitSwitch: 1 | 2 = <default> 💡 是否开启流量限制:1:关闭 2:开启
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_update(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
编辑分享
PUT https://www.123pan.com/api/restful/goapi/v1/share/update
- Payload:
shareId: int 💡 分享 id
shareName: str = <default> 💡 分享名称
expiration: str = <default> 💡 过期时间
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- upload_auth(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_auth(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
认证上传信息,获取上传链接
POST https://www.123pan.com/api/file/s3_upload_object/auth
Note
只能获取 1 个上传链接,用于非分块上传
- Payload:
bucket: str
key: str
storageNode: str
uploadId: str
- upload_complete(payload: dict, /, is_multipart: bool = False, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_complete(payload: dict, /, is_multipart: bool = False, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
完成上传
POST https://www.123pan.com/api/file/upload_complete/v2
- Payload:
FileId: int 💡 文件 id
bucket: str 💡 存储桶
key: str
storageNode: str
uploadId: str
isMultipart: bool = True 💡 是否分块上传
- upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传文件
Note
如果文件名中包含字符
"\/:*?|><,则转换为对应的全角字符- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- upload_file_fast(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] = b'', file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_file_fast(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer] = b'', file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
尝试秒传文件,如果失败也直接返回
- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- upload_list(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_list(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
罗列已经上传的分块
POST https://www.123pan.com/api/file/s3_list_upload_parts
- Payload:
bucket: str
key: str
storageNode: str
uploadId: str
- upload_prepare(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_prepare(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
认证上传信息,获取上传链接
POST https://www.123pan.com/api/file/s3_repare_upload_parts_batch
Note
一次可获取 partNumberEnd - partNumberStart 个上传链接,用于分块上传
- Payload:
bucket: str
key: str
storageNode: str
uploadId: str
partNumberStart: int = 1 💡 开始的分块编号(从 0 开始编号)
partNumberEnd: int = <default> 💡 结束的分块编号(不含)
- upload_request(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_request(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
请求上传,获取一些初始化信息
POST https://www.123pan.com/api/file/upload_request
Note
当响应信息里面有 “Reuse” 的值为 “true”,说明已经存在目录或者文件秒传
- Payload:
fileName: str 💡 文件或目录的名字
driveId: int | str = 0
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
etag: str = “” 💡 文件的 MD5 散列值
parentFileId: int | str = 0 💡 父目录 id
size: int = 0 💡 文件大小,单位:字节
type: 0 | 1 = 1 💡 类型,如果是目录则是 1,如果是文件则是 0
NotReuse: bool = False 💡 不要重用(仅在 type=1 时有效,如果为 False,当有重名时,立即返回,此时
duplicate字段无效)…
- user_device_list(payload: dict | str = 'deviceManagement', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_device_list(payload: dict | str = 'deviceManagement', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
用户设备列表
GET https://www.123pan.com/api/user/device_list
- Payload:
event: str = “deviceManagement” 💡 事件类型,”deviceManagement” 为管理登录设备列表
operateType: int = <default>
- user_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
用户信息
- user_modify_info(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_modify_info(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
修改用户信息,默认行为是 修改用户昵称
POST https://www.123pan.com/api/user/modify_info
- Payload:
event: str 💡 事件类型
nickname: str = <default> 💡 用户昵称
operateType: int = <default>
…
- user_referral_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_referral_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
用户拉新返佣信息
- user_report_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_report_info(base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
用户推送消息配置
GET https://www.123pan.com/b/api/restful/goapi/v1/user/report/info
- user_use_history(payload: dict | str = 'loginRecord', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_use_history(payload: dict | str = 'loginRecord', /, base_url: str | Callable[[], str] = DEFAULT_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
用户使用记录
GET https://www.123pan.com/api/user/use_history
- Payload:
event: str = “loginRecord” 💡 事件类型,”loginRecord” 为登录记录
- class p123client.client.P123OpenClient(client_id: str | PathLike = '', client_secret: str = '', token: None | str | PathLike = None, refresh_token: str = '', check_for_relogin: bool = True)[source]#
Bases:
object123 网盘客户端,仅使用开放接口
- Parameters:
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
token – 123 的访问令牌
refresh_token – 刷新令牌
check_for_relogin – 当 access_token 失效时,是否重新登录
- async_session#
异步请求的 session 对象
- property cookies#
请求所用的 Cookies 对象(同步和异步共用)
- developer_config_forbide_ip_list(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- developer_config_forbide_ip_list(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
ip黑名单列表
GET https://open-api.123pan.com/api/v1/developer/config/forbide-ip/list
Reference
/API列表/直链/IP黑名单配置/ip黑名单列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/mxldrm9d5gpw5h2d
Caution
获取用户配置的黑名单
- developer_config_forbide_ip_switch(payload: dict | Literal[1, 2] = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- developer_config_forbide_ip_switch(payload: dict | Literal[1, 2] = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
开启关闭ip黑名单
POST https://open-api.123pan.com/api/v1/developer/config/forbide-ip/switch
Reference
/API列表/直链/IP黑名单配置/开启关闭ip黑名单
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xwx77dbzrkxquuxm
Caution
此接口需要开通开发者权益
- Payload:
Status: 1 | 2 = 1 💡 状态:1:启用 2:禁用
- developer_config_forbide_ip_update(payload: dict | Iterable[str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- developer_config_forbide_ip_update(payload: dict | Iterable[str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
更新ip黑名单列表
POST https://open-api.123pan.com/api/v1/developer/config/forbide-ip/update
Reference
/API列表/直链/IP黑名单配置/更新ip黑名单列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tt3s54slh87q8wuh
Caution
此接口需要开通开发者权益
- Payload:
IpList: list[str] 💡 IP 地址列表,最多 500 个 IPv4 地址
- dlink_disable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_disable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
禁用直链空间
POST https://open-api.123pan.com/api/v1/direct-link/disable
Reference
/API列表/直链/禁用直链空间
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ccgz6fwf25nd9psl
- Payload:
fileID: int 💡 目录 id
- dlink_disable_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
禁用直链空间
POST https://open-api.123pan.com/api/v1/direct-link/disable
Reference
/API列表/直链/禁用直链空间
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ccgz6fwf25nd9psl
- Payload:
fileID: int 💡 目录 id
- dlink_enable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_enable(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
启用直链空间
POST https://open-api.123pan.com/api/v1/direct-link/enable
Reference
/API列表/直链/启用直链空间
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cl3gvdmho288d376
- Payload:
fileID: int 💡 目录 id
- dlink_enable_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
启用直链空间
POST https://open-api.123pan.com/api/v1/direct-link/enable
Reference
/API列表/直链/启用直链空间
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cl3gvdmho288d376
- Payload:
fileID: int 💡 目录 id
- dlink_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取直链日志
GET https://open-api.123pan.com/api/v1/direct-link/log
Reference
/API列表/直链/获取直链日志
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/agmqpmu0dm0iogc9
Caution
此接口需要开通开发者权益,并且仅限查询近 3 天的日志数据
- Payload:
pageNum: int 💡 第几页
pageSize: int = 100 💡 分页大小
startTime: str = “0001-01-01 00:00:00” 💡 开始时间,格式:YYYY-MM-DD hh:mm:ss
endTime: str. = “9999-12-31 23:59:59” 💡 结束时间,格式:YYYY-MM-DD hh:mm:ss
- dlink_log_open(payload: dict | int = 1, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取直链日志
GET https://open-api.123pan.com/api/v1/direct-link/log
Reference
/API列表/直链/获取直链日志
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/agmqpmu0dm0iogc9
Caution
此接口需要开通开发者权益,并且仅限查询近 3 天的日志数据
- Payload:
pageNum: int 💡 第几页
pageSize: int = 100 💡 分页大小
startTime: str = “0001-01-01 00:00:00” 💡 开始时间,格式:YYYY-MM-DD hh:mm:ss
endTime: str. = “9999-12-31 23:59:59” 💡 结束时间,格式:YYYY-MM-DD hh:mm:ss
- dlink_m3u8(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_m3u8(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取直链转码链接
GET https://open-api.123pan.com/api/v1/direct-link/get/m3u8
- Payload:
fileID: int 💡 文件 id
- Returns:
响应数据的 data 字段是一个字典,键值如下:
名称
类型
是否必填
说明
listarray
必填
响应列表
list[*].resolutionsstring
必填
分辨率
list[*].addressstring
必填
播放地址。请将播放地址放入支持的 hls 协议的播放器中进行播放。示例在线播放地址: https://m3u8-player.com/请注意:转码链接播放过程中将会消耗您的直链流量。如果您开启了直链鉴权,也需要将转码链接根据鉴权指引进行签名。
- dlink_m3u8_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取直链转码链接
GET https://open-api.123pan.com/api/v1/direct-link/get/m3u8
- Payload:
fileID: int 💡 文件 id
- Returns:
响应数据的 data 字段是一个字典,键值如下:
名称
类型
是否必填
说明
listarray
必填
响应列表
list[*].resolutionsstring
必填
分辨率
list[*].addressstring
必填
播放地址。请将播放地址放入支持的 hls 协议的播放器中进行播放。示例在线播放地址: https://m3u8-player.com/请注意:转码链接播放过程中将会消耗您的直链流量。如果您开启了直链鉴权,也需要将转码链接根据鉴权指引进行签名。
- dlink_offline_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_offline_log(payload: dict | int = 1, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取直链离线日志
GET https://open-api.123pan.com/api/v1/direct-link/offline/logs
Reference
/API列表/直链/获取直链离线日志
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yz4bdynw9yx5erqb
Caution
此接口需要开通开发者权益,并且仅限查询近30天的日志数据
- Payload:
pageNum: int 💡 第几页
pageSize: int = 100 💡 分页大小
startHour: str = “0001010100” 💡 开始时间,格式:YYYYMMDDhh
endHour: str. = “9999123123” 💡 结束时间,格式:YYYYMMDDhh
- dlink_transcode(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_transcode(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
发起直链转码
POST https://open-api.123pan.com/api/v1/direct-link/doTranscode
- Payload:
ids: list[int] 💡 视频文件 id 列表
- dlink_transcode_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
发起直链转码
POST https://open-api.123pan.com/api/v1/direct-link/doTranscode
- Payload:
ids: list[int] 💡 视频文件 id 列表
- dlink_transcode_query(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_transcode_query(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
查询直链转码进度
POST https://open-api.123pan.com/api/v1/direct-link/queryTranscode
- Payload:
ids: str 💡 视频文件 id 列表
- Returns:
响应数据的 data 字段是一个字典,键值如下:
名称
类型
是否必填
说明
noneList errorList success
array array array
必填 必填 必填
未发起过转码的 ID 错误文件ID列表,这些文件ID无法进行转码操作 转码成功的文件ID列表
- dlink_transcode_query_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
查询直链转码进度
POST https://open-api.123pan.com/api/v1/direct-link/queryTranscode
- Payload:
ids: str 💡 视频文件 id 列表
- Returns:
响应数据的 data 字段是一个字典,键值如下:
名称
类型
是否必填
说明
noneList errorList success
array array array
必填 必填 必填
未发起过转码的 ID 错误文件ID列表,这些文件ID无法进行转码操作 转码成功的文件ID列表
- dlink_url(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- dlink_url(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取直链链接
GET https://open-api.123pan.com/api/v1/direct-link/url
Reference
/API列表/直链/获取直链链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tdxfsmtemp4gu4o2
- Payload:
fileID: int 💡 文件 id
- dlink_url_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取直链链接
GET https://open-api.123pan.com/api/v1/direct-link/url
Reference
/API列表/直链/获取直链链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tdxfsmtemp4gu4o2
- Payload:
fileID: int 💡 文件 id
- download_info(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- download_info(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
下载
GET https://open-api.123pan.com/api/v1/file/download_info
Reference
/API列表/文件管理/下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fnf60phsushn8ip2
- Payload:
fileId: int 💡 文件 id
- download_info_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
下载
GET https://open-api.123pan.com/api/v1/file/download_info
Reference
/API列表/文件管理/下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fnf60phsushn8ip2
- Payload:
fileId: int 💡 文件 id
- fs_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
批量复制文件
POST https://open-api.123pan.com/api/v1/file/async/copy
Reference
/API列表/文件管理/复制/批量复制文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/pik0i4lvxw4lkkc7
- Payload:
fileIDs: list[int] 💡 文件 id 列表,单级最多支持 3000 个
targetDirId: int = 0 💡 要复制到的目标文件夹 id
- Returns:
返回的数据说明如下:
{ "taskId": int, # 任务 id,后续用来查询任务进度 }
- fs_copy_one(payload: dict | int | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_copy_one(payload: dict | int | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
复制单个文件
POST https://open-api.123pan.com/api/v1/file/copy
Reference
/API列表/文件管理/复制/复制单个文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/thpz0w9er500pob9
- Payload:
fileId: int 💡 文件 id
targetDirId: int = 0 💡 要复制到的目标文件夹 id
- fs_copy_one_open(payload: dict | int | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
复制单个文件
POST https://open-api.123pan.com/api/v1/file/copy
Reference
/API列表/文件管理/复制/复制单个文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/thpz0w9er500pob9
- Payload:
fileId: int 💡 文件 id
targetDirId: int = 0 💡 要复制到的目标文件夹 id
- fs_copy_open(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
批量复制文件
POST https://open-api.123pan.com/api/v1/file/async/copy
Reference
/API列表/文件管理/复制/批量复制文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/pik0i4lvxw4lkkc7
- Payload:
fileIDs: list[int] 💡 文件 id 列表,单级最多支持 3000 个
targetDirId: int = 0 💡 要复制到的目标文件夹 id
- Returns:
返回的数据说明如下:
{ "taskId": int, # 任务 id,后续用来查询任务进度 }
- fs_copy_process(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_copy_process(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
批量复制文件进度
GET https://open-api.123pan.com/api/v1/file/async/copy/process
Reference
/API列表/文件管理/复制/批量复制文件进度
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fqh9vk1esg4uomly
- Payload:
taskId: int 💡 任务 id
- Returns:
返回的数据说明如下:
{ "taskId": int, # 任务 id "status": int, # 任务状态:0-待处理 1-进行中 2-已完成 3-失败 }
- fs_copy_process_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
批量复制文件进度
GET https://open-api.123pan.com/api/v1/file/async/copy/process
Reference
/API列表/文件管理/复制/批量复制文件进度
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fqh9vk1esg4uomly
- Payload:
taskId: int 💡 任务 id
- Returns:
返回的数据说明如下:
{ "taskId": int, # 任务 id "status": int, # 任务状态:0-待处理 1-进行中 2-已完成 3-失败 }
- fs_delete(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_delete(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
彻底删除文件
POST https://open-api.123pan.com/api/v1/file/delete
Attention
彻底删除文件前,文件必须要在回收站中,否则无法删除
Reference
/API列表/文件管理/删除/彻底删除文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sg2gvfk5i3dwoxtg
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- fs_delete_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
彻底删除文件
POST https://open-api.123pan.com/api/v1/file/delete
Attention
彻底删除文件前,文件必须要在回收站中,否则无法删除
Reference
/API列表/文件管理/删除/彻底删除文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sg2gvfk5i3dwoxtg
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- fs_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取单个文件详情
GET https://open-api.123pan.com/api/v1/file/detail
Reference
/API列表/文件管理/文件详情/获取单个文件详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/owapsz373dzwiqbp
Note
支持查询单文件夹包含文件大小
- Payload:
fileID: int 💡 文件 id
- fs_detail_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取单个文件详情
GET https://open-api.123pan.com/api/v1/file/detail
Reference
/API列表/文件管理/文件详情/获取单个文件详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/owapsz373dzwiqbp
Note
支持查询单文件夹包含文件大小
- Payload:
fileID: int 💡 文件 id
- fs_info(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_info(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取多个文件详情
POST https://open-api.123pan.com/api/v1/file/infos
Reference
/API列表/文件管理/文件详情/获取多个文件详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cqqayfuxybegrlru
- Payload:
fileIds: list[int] 💡 文件 id 列表
- fs_info_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取多个文件详情
POST https://open-api.123pan.com/api/v1/file/infos
Reference
/API列表/文件管理/文件详情/获取多个文件详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cqqayfuxybegrlru
- Payload:
fileIds: list[int] 💡 文件 id 列表
- fs_list(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_list(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件列表(推荐)
GET https://open-api.123pan.com/api/v2/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(推荐)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zrip9b0ye81zimv4
/API列表/视频转码/上传视频/云盘上传/获取云盘视频文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yqyi3rqrmrpvdf0d
/API列表/视频转码/获取视频信息/获取转码空间文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ux9wct58lvllxm1n
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页。
Caution
此接口查询结果包含回收站的文件,需自行根据字段
trashed判断处理此接口不支持排序
- Payload:
businessType: int = <default> 💡 业务类型:2:转码空间
category: int = <default> 💡 分类代码:0:未知 1:音频 2:视频 3:图片 4:音频 5:其它 6:保险箱 7:收藏夹
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
searchData: str = <default> 💡 搜索关键字
searchMode: 0 | 1 = 0 💡 搜索模式
0: 模糊搜索(将会根据搜索项分词,查找出相似的匹配项)
1: 精准搜索(精准搜索需要提供完整的文件名)
trashed: bool = False 💡 是否查看回收站的文件
- fs_list_open(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取文件列表(推荐)
GET https://open-api.123pan.com/api/v2/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(推荐)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zrip9b0ye81zimv4
/API列表/视频转码/上传视频/云盘上传/获取云盘视频文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yqyi3rqrmrpvdf0d
/API列表/视频转码/获取视频信息/获取转码空间文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ux9wct58lvllxm1n
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页。
Caution
此接口查询结果包含回收站的文件,需自行根据字段
trashed判断处理此接口不支持排序
- Payload:
businessType: int = <default> 💡 业务类型:2:转码空间
category: int = <default> 💡 分类代码:0:未知 1:音频 2:视频 3:图片 4:音频 5:其它 6:保险箱 7:收藏夹
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
searchData: str = <default> 💡 搜索关键字
searchMode: 0 | 1 = 0 💡 搜索模式
0: 模糊搜索(将会根据搜索项分词,查找出相似的匹配项)
1: 精准搜索(精准搜索需要提供完整的文件名)
trashed: bool = False 💡 是否查看回收站的文件
- fs_list_v1(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_list_v1(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取文件列表(旧)
GET https://open-api.123pan.com/api/v1/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(旧)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/hosdqqax0knovnm2
Note
是否有下一页需要自行判断。如果返回的列表大小 <
limit,或者根据返回值里的 “total”,如果 =page * limit,都说明没有下一页- Payload:
limit: int = 100 💡 分页大小,最多 100
orderBy: str = “file_name” 💡 排序依据
“file_id”: 文件 id
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
“share_id”: 分享 id
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
“asc”: 升序,从小到大
“desc”: 降序,从大到小
page: int = 1 💡 第几页,从 1 开始(可传 0 或不传,视为 1)
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
trashed: bool = False 💡 是否查看回收站的文件
searchData: str = <default> 💡 搜索关键字
- fs_list_v1_open(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取文件列表(旧)
GET https://open-api.123pan.com/api/v1/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(旧)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/hosdqqax0knovnm2
Note
是否有下一页需要自行判断。如果返回的列表大小 <
limit,或者根据返回值里的 “total”,如果 =page * limit,都说明没有下一页- Payload:
limit: int = 100 💡 分页大小,最多 100
orderBy: str = “file_name” 💡 排序依据
“file_id”: 文件 id
“file_name”: 文件名
“size”: 文件大小
“create_at”: 创建时间
“update_at”: 创建时间
“update_time”: 更新时间
“share_id”: 分享 id
…(其它可能值)
orderDirection: “asc” | “desc” = “asc” 💡 排序顺序
“asc”: 升序,从小到大
“desc”: 降序,从大到小
page: int = 1 💡 第几页,从 1 开始(可传 0 或不传,视为 1)
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
trashed: bool = False 💡 是否查看回收站的文件
searchData: str = <default> 💡 搜索关键字
- fs_list_v2(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取文件列表(推荐)
GET https://open-api.123pan.com/api/v2/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(推荐)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zrip9b0ye81zimv4
/API列表/视频转码/上传视频/云盘上传/获取云盘视频文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yqyi3rqrmrpvdf0d
/API列表/视频转码/获取视频信息/获取转码空间文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ux9wct58lvllxm1n
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页。
Caution
此接口查询结果包含回收站的文件,需自行根据字段
trashed判断处理此接口不支持排序
- Payload:
businessType: int = <default> 💡 业务类型:2:转码空间
category: int = <default> 💡 分类代码:0:未知 1:音频 2:视频 3:图片 4:音频 5:其它 6:保险箱 7:收藏夹
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
searchData: str = <default> 💡 搜索关键字
searchMode: 0 | 1 = 0 💡 搜索模式
0: 模糊搜索(将会根据搜索项分词,查找出相似的匹配项)
1: 精准搜索(精准搜索需要提供完整的文件名)
trashed: bool = False 💡 是否查看回收站的文件
- fs_list_v2_open(payload: dict | int | str = 0, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取文件列表(推荐)
GET https://open-api.123pan.com/api/v2/file/list
Reference
/API列表/文件管理/文件列表/获取文件列表(推荐)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zrip9b0ye81zimv4
/API列表/视频转码/上传视频/云盘上传/获取云盘视频文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yqyi3rqrmrpvdf0d
/API列表/视频转码/获取视频信息/获取转码空间文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ux9wct58lvllxm1n
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页。
Caution
此接口查询结果包含回收站的文件,需自行根据字段
trashed判断处理此接口不支持排序
- Payload:
businessType: int = <default> 💡 业务类型:2:转码空间
category: int = <default> 💡 分类代码:0:未知 1:音频 2:视频 3:图片 4:音频 5:其它 6:保险箱 7:收藏夹
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,根目录是 0
searchData: str = <default> 💡 搜索关键字
searchMode: 0 | 1 = 0 💡 搜索模式
0: 模糊搜索(将会根据搜索项分词,查找出相似的匹配项)
1: 精准搜索(精准搜索需要提供完整的文件名)
trashed: bool = False 💡 是否查看回收站的文件
- fs_mkdir(payload: dict | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_mkdir(payload: dict | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建目录
POST https://open-api.123pan.com/upload/v1/file/mkdir
Reference
/API列表/文件管理/上传/创建目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ouyvcxqg3185zzk4
- Payload:
name: str 💡 文件名,不能重名
parentID: int = 0 💡 父目录 id,根目录是 0
- fs_mkdir_open(payload: dict | str, /, parent_id: int | str = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建目录
POST https://open-api.123pan.com/upload/v1/file/mkdir
Reference
/API列表/文件管理/上传/创建目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ouyvcxqg3185zzk4
- Payload:
name: str 💡 文件名,不能重名
parentID: int = 0 💡 父目录 id,根目录是 0
- fs_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
移动
POST https://open-api.123pan.com/api/v1/file/move
Reference
/API列表/文件管理/移动
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rsyfsn1gnpgo4m4f
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
toParentFileID: int = 0 💡 要移动到的目标目录 id,根目录是 0
- fs_move_open(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
移动
POST https://open-api.123pan.com/api/v1/file/move
Reference
/API列表/文件管理/移动
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rsyfsn1gnpgo4m4f
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
toParentFileID: int = 0 💡 要移动到的目标目录 id,根目录是 0
- fs_recover(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_recover(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
从回收站恢复文件
POST https://open-api.123pan.com/api/v1/file/recover
Note
将回收站的文件恢复至删除前的位置
Reference
/API列表/文件管理/删除/从回收站恢复文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kx9f8b6wk6g55uwy
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- Returns:
返回的数据说明如下:
{ "abnormalFileIDs": list[int], # 异常文件目录 id(父级目录不存在),可使用还原文件到指定目录接口;无异常文件则为空 }
- fs_recover_by_path(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_recover_by_path(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
还原文件到指定目录
POST https://open-api.123pan.com/api/v1/file/recover/by_path
Note
将回收站的文件恢复至指定位置
Reference
/API列表/文件管理/删除/还原文件到指定目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cl24atug2sviq12z
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
parentFileID: int = 0 💡 指定目录 id
- fs_recover_by_path_open(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
还原文件到指定目录
POST https://open-api.123pan.com/api/v1/file/recover/by_path
Note
将回收站的文件恢复至指定位置
Reference
/API列表/文件管理/删除/还原文件到指定目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/cl24atug2sviq12z
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
parentFileID: int = 0 💡 指定目录 id
- fs_recover_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
从回收站恢复文件
POST https://open-api.123pan.com/api/v1/file/recover
Note
将回收站的文件恢复至删除前的位置
Reference
/API列表/文件管理/删除/从回收站恢复文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kx9f8b6wk6g55uwy
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- Returns:
返回的数据说明如下:
{ "abnormalFileIDs": list[int], # 异常文件目录 id(父级目录不存在),可使用还原文件到指定目录接口;无异常文件则为空 }
- fs_rename(payload: dict | str | tuple[int | str, str] | Iterable[str | tuple[int | str, str]], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_rename(payload: dict | str | tuple[int | str, str] | Iterable[str | tuple[int | str, str]], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
批量文件重命名
POST https://open-api.123pan.com/api/v1/file/rename
Reference
/API列表/文件管理/重命名/批量文件重命名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/imhguepnr727aquk
- Payload:
renameList: list[str] 💡 列表,每个成员的格式为 f”{fileId}|{fileName}”,最多 30 个
- fs_rename_one(payload: dict | str | tuple[int | str, str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_rename_one(payload: dict | str | tuple[int | str, str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
单个文件重命名
PUT https://open-api.123pan.com/api/v1/file/name
Reference
/API列表/文件管理/重命名/单个文件重命名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ha6mfe9tteht5skc
- Payload:
fileId: int 💡 文件 id
fileName: str 💡 文件名
- fs_rename_one_open(payload: dict | str | tuple[int | str, str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
单个文件重命名
PUT https://open-api.123pan.com/api/v1/file/name
Reference
/API列表/文件管理/重命名/单个文件重命名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ha6mfe9tteht5skc
- Payload:
fileId: int 💡 文件 id
fileName: str 💡 文件名
- fs_rename_open(payload: dict | str | tuple[int | str, str] | Iterable[str | tuple[int | str, str]], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
批量文件重命名
POST https://open-api.123pan.com/api/v1/file/rename
Reference
/API列表/文件管理/重命名/批量文件重命名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/imhguepnr727aquk
- Payload:
renameList: list[str] 💡 列表,每个成员的格式为 f”{fileId}|{fileName}”,最多 30 个
- fs_trash(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- fs_trash(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
删除文件至回收站
POST https://open-api.123pan.com/api/v1/file/trash
Reference
/API列表/文件管理/删除/删除文件至回收站
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/en07662k2kki4bo6
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- fs_trash_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
删除文件至回收站
POST https://open-api.123pan.com/api/v1/file/trash
Reference
/API列表/文件管理/删除/删除文件至回收站
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/en07662k2kki4bo6
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- property headers: MutableMapping#
请求头,无论同步还是异步请求都共用这个请求头
- login(client_id: str = '', client_secret: str = '', refresh_token: str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login(client_id: str = '', client_secret: str = '', refresh_token: str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
登录以获取 access_token
- Parameters:
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
refresh_token – 刷新令牌
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口的响应信息
- login_another_oauth(redirect_uri: str, client_id: str = '', client_secret: str = '', replace: bool | Self = False, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) Self[source]#
- login_another_oauth(redirect_uri: str, client_id: str = '', client_secret: str = '', replace: bool | Self = False, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]
第三方应用授权登录
- Parameters:
redirect_uri – 回调链接
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
replace –
替换某个 client 对象的 token
如果为 P123Client, 则更新到此对象
如果为 True,则更新到 self`
如果为 False,否则返回新的
P123Client对象
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- login_another_refresh_token(refresh_token: str = '', replace: bool | Self = False, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) Self[source]#
- login_another_refresh_token(refresh_token: str = '', replace: bool | Self = False, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]
登录以获取 access_token
- Parameters:
refresh_token – 刷新令牌
replace –
替换某个 client 对象的 token
如果为 P123Client, 则更新到此对象
如果为 True,则更新到 self`
如果为 False,否则返回新的
P123Client对象
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口的响应信息
- static login_oauth_authorize(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_oauth_authorize(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
授权以获取和
accessToken绑定的codeGET https://open-api.123pan.com/api/v1/oauth2/user/authorize
Reference
/接入指南/第三方挂载应用接入/授权地址
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gr7ggimkcysm18ap
- Payload:
accessToken: str 💡 访问令牌
client_id: str 💡 应用标识,创建应用时分配的 appId
redirect_uri: str 💡 回调链接
scope: str = “user:base,file:all:read,file:all:write” 💡 权限
response_type: str = “code”
state: str = <default>
- static login_oauth_authorize_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', request: None | Callable = None, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
授权以获取和
accessToken绑定的codeGET https://open-api.123pan.com/api/v1/oauth2/user/authorize
Reference
/接入指南/第三方挂载应用接入/授权地址
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gr7ggimkcysm18ap
- Payload:
accessToken: str 💡 访问令牌
client_id: str 💡 应用标识,创建应用时分配的 appId
redirect_uri: str 💡 回调链接
scope: str = “user:base,file:all:read,file:all:write” 💡 权限
response_type: str = “code”
state: str = <default>
- static login_oauth_token(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_oauth_token(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
通过
authorization_code或refresh_token获取新的access_token和refresh_tokenPOST https://open-api.123pan.com/api/v1/oauth2/access_token
Note
通过这种方式授权得到的
access_token,各个接口分别允许更高的 QPS/接入指南/第三方挂载应用接入/授权须知
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kf05anzt1r0qnudd
Reference
/接入指南/第三方挂载应用接入/授权code获取access_token
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gammzlhe6k4qtwd9
- Payload:
client_id: str 💡 应用标识,创建应用时分配的 appId
client_secret: str 💡 应用密钥,创建应用时分配的 secretId
code: str = <default> 💡 授权码
grant_type: “authorization_code” | “refresh_token” = <default> 💡 身份类型
redirect_uri: str = <default> 💡 应用注册的回调地址,
grant_type为 “authorization_code” 时必携带refresh_token: str = <default> 💡 刷新 token,单次请求有效
- static login_oauth_token_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', request: None | Callable = None, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
通过
authorization_code或refresh_token获取新的access_token和refresh_tokenPOST https://open-api.123pan.com/api/v1/oauth2/access_token
Note
通过这种方式授权得到的
access_token,各个接口分别允许更高的 QPS/接入指南/第三方挂载应用接入/授权须知
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kf05anzt1r0qnudd
Reference
/接入指南/第三方挂载应用接入/授权code获取access_token
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gammzlhe6k4qtwd9
- Payload:
client_id: str 💡 应用标识,创建应用时分配的 appId
client_secret: str 💡 应用密钥,创建应用时分配的 secretId
code: str = <default> 💡 授权码
grant_type: “authorization_code” | “refresh_token” = <default> 💡 身份类型
redirect_uri: str = <default> 💡 应用注册的回调地址,
grant_type为 “authorization_code” 时必携带refresh_token: str = <default> 💡 刷新 token,单次请求有效
- static login_oauth_verify(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_oauth_verify(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
检查
appId对应的redirectUri是否可用POST https://open-api.123pan.com/api/v1/oauth2/app/verify
Reference
/接入指南/第三方挂载应用接入/授权地址
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gr7ggimkcysm18ap
- Payload:
appId: str 💡 应用标识,创建应用时分配的 appId
redirectUri: str 💡 回调链接
scope: str = “user:base,file:all:read,file:all:write” 💡 权限
- static login_oauth_verify_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', request: None | Callable = None, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
检查
appId对应的redirectUri是否可用POST https://open-api.123pan.com/api/v1/oauth2/app/verify
Reference
/接入指南/第三方挂载应用接入/授权地址
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gr7ggimkcysm18ap
- Payload:
appId: str 💡 应用标识,创建应用时分配的 appId
redirectUri: str 💡 回调链接
scope: str = “user:base,file:all:read,file:all:write” 💡 权限
- login_open(client_id: str = '', client_secret: str = '', refresh_token: str = '', base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
登录以获取 access_token
- Parameters:
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
refresh_token – 刷新令牌
base_url – 接口的基地址
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口的响应信息
- static login_token(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- static login_token(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, request: None | Callable = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取access_token
POST https://open-api.123pan.com/api/v1/access_token
Attention
此接口有访问频率限制。请获取到
access_token后本地保存使用,并在 access_token `过期前及时重新获取。``access_token` 有效期根据返回的 “expiredAt” 字段判断。Note
通过这种方式授权得到的
access_token,各个接口分别允许一个较低的 QPS/接入指南/开发者接入/开发须知
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txgcvbfgh0gtuad5
Reference
/接入指南/开发者接入/获取access_token
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gn1nai4x0v0ry9ki
- Payload:
clientID: str 💡 应用标识,创建应用时分配的 appId
clientSecret: str 💡 应用密钥,创建应用时分配的 secretId
- static login_token_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', request: None | Callable = None, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取access_token
POST https://open-api.123pan.com/api/v1/access_token
Attention
此接口有访问频率限制。请获取到
access_token后本地保存使用,并在 access_token `过期前及时重新获取。``access_token` 有效期根据返回的 “expiredAt” 字段判断。Note
通过这种方式授权得到的
access_token,各个接口分别允许一个较低的 QPS/接入指南/开发者接入/开发须知
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txgcvbfgh0gtuad5
Reference
/接入指南/开发者接入/获取access_token
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/gn1nai4x0v0ry9ki
- Payload:
clientID: str 💡 应用标识,创建应用时分配的 appId
clientSecret: str 💡 应用密钥,创建应用时分配的 secretId
- login_with_oauth(client_id: str, client_secret: str, redirect_uri: str, token: str, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login_with_oauth(client_id: str, client_secret: str, redirect_uri: str, token: str, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
第三方应用授权登录
- Parameters:
client_id – 应用标识,创建应用时分配的 appId
client_secret – 应用密钥,创建应用时分配的 secretId
redirect_uri – 回调链接
token – 访问令牌
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- login_with_refresh_token(refresh_token: str, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- login_with_refresh_token(refresh_token: str, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
通过刷新令牌登录
- Parameters:
refresh_token – 刷新令牌
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- offline_download(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_download(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建离线下载任务
POST https://open-api.123pan.com/api/v1/offline/download
Reference
/API列表/离线下载/创建离线下载任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/he47hsq2o1xvgado
- Payload:
callBackUrl: str = <default> 💡 回调地址,任务结束时调用以推送通知,需要支持 POST 并接受 JSON 数据,格式为
{ url: string, // 下载资源地址 status: 0 | 1, // 是否失败 fileReason: str, // 失败原因 fileID: int, // 成功后,该文件在云盘上的 id }
dirID: int = <default> 💡 指定下载到的目录的 id。默认会下载到 “/来自:离线下载” 目录中
fileName: str = “” 💡 自定义文件名称
url: str 💡 下载链接,支持 http/https
- offline_download_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建离线下载任务
POST https://open-api.123pan.com/api/v1/offline/download
Reference
/API列表/离线下载/创建离线下载任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/he47hsq2o1xvgado
- Payload:
callBackUrl: str = <default> 💡 回调地址,任务结束时调用以推送通知,需要支持 POST 并接受 JSON 数据,格式为
{ url: string, // 下载资源地址 status: 0 | 1, // 是否失败 fileReason: str, // 失败原因 fileID: int, // 成功后,该文件在云盘上的 id }
dirID: int = <default> 💡 指定下载到的目录的 id。默认会下载到 “/来自:离线下载” 目录中
fileName: str = “” 💡 自定义文件名称
url: str 💡 下载链接,支持 http/https
- offline_process(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- offline_process(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取离线下载进度
GET https://open-api.123pan.com/api/v1/offline/download/process
Reference
/API列表/离线下载/获取离线下载进度
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sclficr3t655pii5
- Payload:
taskID: int 💡 离线下载任务 id
- offline_process_open(payload: dict | int, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取离线下载进度
GET https://open-api.123pan.com/api/v1/offline/download/process
Reference
/API列表/离线下载/获取离线下载进度
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sclficr3t655pii5
- Payload:
taskID: int 💡 离线下载任务 id
- oss_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_copy(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建复制任务
POST https://open-api.123pan.com/api/v1/oss/source/copy
Note
图床复制任务创建(可创建的任务数:3,fileIDs 长度限制:100,当前一个任务处理完后将会继续处理下个任务)。
该接口将会复制云盘里的文件或目录对应的图片到对应图床目录,每次任务包含的图片总数限制 1000 张,图片格式:png, gif, jpeg, tiff, webp,jpg,tif,svg,bmp,图片大小限制:100M,文件夹层级限制:15层。
如果图床目录下存在相同 etag、size 的图片将会视为同一张图片,将覆盖原图片
Reference
/API列表/图床/复制云盘图片/创建复制任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/trahy3lmds4o0i3r
- Payload:
fileIDs: list[int] 💡 文件 id 列表
toParentFileID: int = 0 💡 要移动到的目标目录 id,默认为根目录
sourceType: int = 1 💡 复制来源:1:云盘
type: int = 1 💡 业务类型,固定为 1
- oss_copy_fail(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_copy_fail(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取复制失败文件列表
GET https://open-api.123pan.com/api/v1/oss/source/copy/fail
Reference
/API列表/图床/复制云盘图片/获取复制失败文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tlug9od3xlw2w23v
- Payload:
taskID: str 💡 复制任务 id
limit: int = 100 💡 每页条数,最多 100 个
page: int = 1 💡 第几页
- oss_copy_fail_open(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取复制失败文件列表
GET https://open-api.123pan.com/api/v1/oss/source/copy/fail
Reference
/API列表/图床/复制云盘图片/获取复制失败文件列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tlug9od3xlw2w23v
- Payload:
taskID: str 💡 复制任务 id
limit: int = 100 💡 每页条数,最多 100 个
page: int = 1 💡 第几页
- oss_copy_open(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建复制任务
POST https://open-api.123pan.com/api/v1/oss/source/copy
Note
图床复制任务创建(可创建的任务数:3,fileIDs 长度限制:100,当前一个任务处理完后将会继续处理下个任务)。
该接口将会复制云盘里的文件或目录对应的图片到对应图床目录,每次任务包含的图片总数限制 1000 张,图片格式:png, gif, jpeg, tiff, webp,jpg,tif,svg,bmp,图片大小限制:100M,文件夹层级限制:15层。
如果图床目录下存在相同 etag、size 的图片将会视为同一张图片,将覆盖原图片
Reference
/API列表/图床/复制云盘图片/创建复制任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/trahy3lmds4o0i3r
- Payload:
fileIDs: list[int] 💡 文件 id 列表
toParentFileID: int = 0 💡 要移动到的目标目录 id,默认为根目录
sourceType: int = 1 💡 复制来源:1:云盘
type: int = 1 💡 业务类型,固定为 1
- oss_copy_process(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_copy_process(payload: dict | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取复制任务详情
GET https://open-api.123pan.com/api/v1/oss/source/copy/process
Reference
/API列表/图床/复制云盘图片/获取复制任务详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rissl4ewklaui4th
- Payload:
taskID: str 💡 复制任务 id
- oss_copy_process_open(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取复制任务详情
GET https://open-api.123pan.com/api/v1/oss/source/copy/process
Reference
/API列表/图床/复制云盘图片/获取复制任务详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rissl4ewklaui4th
- Payload:
taskID: str 💡 复制任务 id
- oss_delete(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_delete(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
删除图片
POST https://open-api.123pan.com/api/v1/oss/file/delete
Attention
彻底删除文件前,文件必须要在回收站中,否则无法删除
Reference
/API列表/图床/删除图片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ef8yluqdzm2yttdn
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- oss_delete_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
删除图片
POST https://open-api.123pan.com/api/v1/oss/file/delete
Attention
彻底删除文件前,文件必须要在回收站中,否则无法删除
Reference
/API列表/图床/删除图片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ef8yluqdzm2yttdn
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
- oss_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_detail(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取图片详情
GET https://open-api.123pan.com/api/v1/oss/file/detail
Reference
/API列表/图床/获取图片信息/获取图片详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rgf2ndfaxc2gugp8
- Payload:
fileID: int 💡 文件 id
- oss_detail_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取图片详情
GET https://open-api.123pan.com/api/v1/oss/file/detail
Reference
/API列表/图床/获取图片信息/获取图片详情
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/rgf2ndfaxc2gugp8
- Payload:
fileID: int 💡 文件 id
- oss_list(payload: dict | int | str = '', /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_list(payload: dict | int | str = '', /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取图片列表
POST https://open-api.123pan.com/api/v1/oss/file/list
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页
Reference
/API列表/图床/获取图片信息/获取图片列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zayr72q8xd7gg4f8
- Payload:
endTime: int = <default> 💡 筛选结束时间,时间戳格式,单位:秒
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,默认为根目录
startTime: int = <default> 💡 筛选开始时间,时间戳格式,单位:秒
type: int = 1 💡 业务类型,固定为 1
- oss_list_open(payload: dict | int | str = '', /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取图片列表
POST https://open-api.123pan.com/api/v1/oss/file/list
Note
如果返回信息中,”lastFileId” 字段的值为 “-1”,代表最后一页(无需再翻页查询)。 其它则代表下一页开始的文件 id,携带到请求参数中,可查询下一页
Reference
/API列表/图床/获取图片信息/获取图片列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/zayr72q8xd7gg4f8
- Payload:
endTime: int = <default> 💡 筛选结束时间,时间戳格式,单位:秒
lastFileId: int = <default> 💡 上一页的最后一条记录的 FileID,翻页查询时需要填写
limit: int = 100 💡 分页大小,最多 100
parentFileId: int | str = 0 💡 父目录 id,默认为根目录
startTime: int = <default> 💡 筛选开始时间,时间戳格式,单位:秒
type: int = 1 💡 业务类型,固定为 1
- oss_mkdir(payload: dict | str, /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_mkdir(payload: dict | str, /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建目录
POST https://open-api.123pan.com/upload/v1/oss/file/mkdir
Reference
/API列表/图床/上传图片/创建目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tpqqm04ocqwvonrk
- Payload:
name: str 💡 文件名,不能重名
parentID: int = 0 💡 父目录 id,默认为根目录
type: int = 1 💡 业务类型,固定为 1
- oss_mkdir_open(payload: dict | str, /, parent_id: int | str = '', base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建目录
POST https://open-api.123pan.com/upload/v1/oss/file/mkdir
Reference
/API列表/图床/上传图片/创建目录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tpqqm04ocqwvonrk
- Payload:
name: str 💡 文件名,不能重名
parentID: int = 0 💡 父目录 id,默认为根目录
type: int = 1 💡 业务类型,固定为 1
- oss_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_move(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
移动图片
POST https://open-api.123pan.com/api/v1/oss/file/move
Reference
/API列表/图床/移动图片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/eqeargimuvycddna
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
toParentFileID: int = 0 💡 要移动到的目标目录 id,默认是根目录
- oss_move_open(payload: dict | int | str | Iterable[int | str], /, parent_id: int | str = '', base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
移动图片
POST https://open-api.123pan.com/api/v1/oss/file/move
Reference
/API列表/图床/移动图片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/eqeargimuvycddna
- Payload:
fileIDs: list[int] 💡 文件 id 列表,最多 100 个
toParentFileID: int = 0 💡 要移动到的目标目录 id,默认是根目录
- oss_offline_download(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_offline_download(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建离线迁移任务
POST https://open-api.123pan.com/api/v1/oss/offline/download
Reference
/API列表/图床/图床离线迁移/创建离线迁移任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ctigc3a08lqzsfnq
- Payload:
businessDirID: int = <default> 💡 指定下载到的目录的 id。默认会下载到 “/来自:离线下载” 目录中
callBackUrl: str = <default> 💡 回调地址,任务结束时调用以推送通知,需要支持 POST 并接受 JSON 数据,格式为
{ url: string, // 下载资源地址 status: 0 | 1, // 是否失败 fileReason: str, // 失败原因 fileID: int, // 成功后,该文件在云盘上的 id }
fileName: str = “” 💡 自定义文件名称
type: int = 1 💡 业务类型,固定为 1
url: str 💡 下载链接,支持 http/https
- oss_offline_download_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建离线迁移任务
POST https://open-api.123pan.com/api/v1/oss/offline/download
Reference
/API列表/图床/图床离线迁移/创建离线迁移任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ctigc3a08lqzsfnq
- Payload:
businessDirID: int = <default> 💡 指定下载到的目录的 id。默认会下载到 “/来自:离线下载” 目录中
callBackUrl: str = <default> 💡 回调地址,任务结束时调用以推送通知,需要支持 POST 并接受 JSON 数据,格式为
{ url: string, // 下载资源地址 status: 0 | 1, // 是否失败 fileReason: str, // 失败原因 fileID: int, // 成功后,该文件在云盘上的 id }
fileName: str = “” 💡 自定义文件名称
type: int = 1 💡 业务类型,固定为 1
url: str 💡 下载链接,支持 http/https
- oss_offline_process(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_offline_process(payload: dict | int, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取离线迁移任务
GET https://open-api.123pan.com/api/v1/oss/offline/download/process
Reference
/API列表/图床/图床离线迁移/获取离线迁移任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/svo92desugbyhrgq
- Payload:
taskID: int 💡 离线下载任务 id
- oss_offline_process_open(payload: dict | int, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取离线迁移任务
GET https://open-api.123pan.com/api/v1/oss/offline/download/process
Reference
/API列表/图床/图床离线迁移/获取离线迁移任务
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/svo92desugbyhrgq
- Payload:
taskID: int 💡 离线下载任务 id
- oss_upload_complete(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_complete(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传完毕
POST https://open-api.123pan.com/upload/v1/oss/file/upload_complete
Reference
/API列表/图床/上传图片/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yhgo0kt3nkngi8r2
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- oss_upload_complete_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传完毕
POST https://open-api.123pan.com/upload/v1/oss/file/upload_complete
Reference
/API列表/图床/上传图片/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yhgo0kt3nkngi8r2
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- oss_upload_create(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_create(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建文件
POST https://open-api.123pan.com/upload/v1/oss/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
不会重名
Reference
/API列表/图床/上传图片/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xwfka5kt6vtmgs8r
- Payload:
filename: str 💡 文件名
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,默认为根目录
size: int 💡 文件大小,单位:字节
type: int = 1 💡 业务类型,固定为 1
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 }
- oss_upload_create_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建文件
POST https://open-api.123pan.com/upload/v1/oss/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
不会重名
Reference
/API列表/图床/上传图片/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xwfka5kt6vtmgs8r
- Payload:
filename: str 💡 文件名
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,默认为根目录
size: int 💡 文件大小,单位:字节
type: int = 1 💡 业务类型,固定为 1
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 }
- oss_upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = '', duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = '', duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传文件
Note
如果文件名中包含字符
"\/:*?|><,则转换为对应的全角字符Reference
/API列表/图床/上传图片/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/di0url3qn13tk28t
- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录,默认为根目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
preupload_id – 预上传 id,用于断点续传,提供此参数,则会忽略
file_md5、file_name、file_size、parent_id和duplicateslice_size – 分块大小,断点续传时,如果只上传过少于 2 个分块时,会被使用
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- oss_upload_file_open(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = '', duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传文件
Note
如果文件名中包含字符
"\/:*?|><,则转换为对应的全角字符Reference
/API列表/图床/上传图片/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/di0url3qn13tk28t
- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录,默认为根目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
preupload_id – 预上传 id,用于断点续传,提供此参数,则会忽略
file_md5、file_name、file_size、parent_id和duplicateslice_size – 分块大小,断点续传时,如果只上传过少于 2 个分块时,会被使用
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- oss_upload_list(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_list(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
列举已上传分片
POST https://open-api.123pan.com/upload/v1/oss/file/list_upload_parts
Note
此接口用于罗列已经上传的分片信息,以供比对
- Payload:
preuploadID: str 💡 预上传 id
- oss_upload_list_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
列举已上传分片
POST https://open-api.123pan.com/upload/v1/oss/file/list_upload_parts
Note
此接口用于罗列已经上传的分片信息,以供比对
- Payload:
preuploadID: str 💡 预上传 id
- oss_upload_result(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_result(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
异步轮询获取上传结果
POST https://open-api.123pan.com/upload/v1/oss/file/upload_async_result
Reference
/API列表/图床/上传图片/异步轮询获取上传结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/lbdq2cbyzfzayipu
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传合并是否完成,如果为 False,请至少 1 秒后再发起轮询 "fileID": int, # 上传的文件 id }
- oss_upload_result_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
异步轮询获取上传结果
POST https://open-api.123pan.com/upload/v1/oss/file/upload_async_result
Reference
/API列表/图床/上传图片/异步轮询获取上传结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/lbdq2cbyzfzayipu
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传合并是否完成,如果为 False,请至少 1 秒后再发起轮询 "fileID": int, # 上传的文件 id }
- oss_upload_url(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- oss_upload_url(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取上传地址&上传分片
POST https://open-api.123pan.com/upload/v1/oss/file/get_upload_url
Note
有多个分片时,轮流分别根据序号获取下载链接,然后 PUT 方法上传分片。由于上传链接会过期,所以没必要提前获取一大批
Reference
/API列表/图床/上传图片/获取上传地址&上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/pyfo3a39q6ac0ocd
- Payload:
preuploadID: str 💡 预上传 id
sliceNo: int 💡 分片序号,从 1 开始自增
- oss_upload_url_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取上传地址&上传分片
POST https://open-api.123pan.com/upload/v1/oss/file/get_upload_url
Note
有多个分片时,轮流分别根据序号获取下载链接,然后 PUT 方法上传分片。由于上传链接会过期,所以没必要提前获取一大批
Reference
/API列表/图床/上传图片/获取上传地址&上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/pyfo3a39q6ac0ocd
- Payload:
preuploadID: str 💡 预上传 id
sliceNo: int 💡 分片序号,从 1 开始自增
- request(url: str, method: str = 'GET', request: None | Callable = None, base_url: str | Callable[[], str] = 'https://www.123pan.com/b', headers=None, async_: Literal[False, True] = False, **request_kwargs)[source]#
执行 HTTP 请求,默认为 GET 方法
- session#
同步请求的 session 对象
- share_create(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建分享链接
POST https://open-api.123pan.com/api/v1/share/create
Reference
/API列表/分享管理/创建分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/dwd2ss0qnpab5i5s
- Payload:
fileIDList: str 💡 分享文件 id 列表,最多 100 个,用逗号,分隔连接
shareExpire: 0 | 1 | 7 | 30 = 0 💡 分享链接有效期天数,0 为永久
shareName: str 💡 分享链接名称,须小于 35 个字符且不能包含特殊字符
"\/:*?|><sharePwd: str = “” 💡 提取码(不区分大小写)
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
创建分享链接
POST https://open-api.123pan.com/api/v1/share/create
Reference
/API列表/分享管理/创建分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/dwd2ss0qnpab5i5s
- Payload:
fileIDList: str 💡 分享文件 id 列表,最多 100 个,用逗号,分隔连接
shareExpire: 0 | 1 | 7 | 30 = 0 💡 分享链接有效期天数,0 为永久
shareName: str 💡 分享链接名称,须小于 35 个字符且不能包含特殊字符
"\/:*?|><sharePwd: str = “” 💡 提取码(不区分大小写)
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_create_payment(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建付费分享链接
POST https://open-api.123pan.com/api/v1/share/content-payment/create
Reference
/API列表/分享管理/创建付费分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/qz30c5k2npe8l98r
- Payload:
fileIDList: str 💡 分享文件 id 列表,最多 100 个,用逗号,分隔连接
shareName: str 💡 分享链接名称,须小于 35 个字符且不能包含特殊字符
"\/:*?|><isReward: 0 | 1 = 0 💡 是否开启打赏
payAmount: int = 1 💡 金额,从 1 到 99,单位:元
resourceDesc: str = “” 💡 资源描述
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
创建付费分享链接
POST https://open-api.123pan.com/api/v1/share/content-payment/create
Reference
/API列表/分享管理/创建付费分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/qz30c5k2npe8l98r
- Payload:
fileIDList: str 💡 分享文件 id 列表,最多 100 个,用逗号,分隔连接
shareName: str 💡 分享链接名称,须小于 35 个字符且不能包含特殊字符
"\/:*?|><isReward: 0 | 1 = 0 💡 是否开启打赏
payAmount: int = 1 💡 金额,从 1 到 99,单位:元
resourceDesc: str = “” 💡 资源描述
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_edit(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
修改分享链接
PUT https://open-api.123pan.com/api/v1/share/list/info
Reference
/API列表/分享管理/修改分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ga6hhca1u8v9yqx0
- Payload:
shareIdList: list[int] 💡 分享链接 id 列表,最多 100 个
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
修改分享链接
PUT https://open-api.123pan.com/api/v1/share/list/info
Reference
/API列表/分享管理/修改分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ga6hhca1u8v9yqx0
- Payload:
shareIdList: list[int] 💡 分享链接 id 列表,最多 100 个
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_edit_payment(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
修改付费分享链接
PUT https://open-api.123pan.com/api/v1/share/list/payment/info
Reference
/API列表/分享管理/修改付费分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/euz8kc7fcyye496g
- Payload:
shareIdList: list[int] 💡 分享链接 id 列表,最多 100 个
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
修改付费分享链接
PUT https://open-api.123pan.com/api/v1/share/list/payment/info
Reference
/API列表/分享管理/修改付费分享链接
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/euz8kc7fcyye496g
- Payload:
shareIdList: list[int] 💡 分享链接 id 列表,最多 100 个
trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
1: 游客免登录提取(关) 超流量用户提取(关)
2: 游客免登录提取(开) 超流量用户提取(关)
3: 游客免登录提取(关) 超流量用户提取(开)
4: 游客免登录提取(开) 超流量用户提取(开)
- share_list(payload: dict | int = 100, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取分享链接列表
GET https://open-api.123pan.com/api/v1/share/list
Reference
/API列表/分享管理/获取分享链接列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ixg0arldi61fe7av
- Payload:
limit: int = 100 💡 每页文件数量,最多 100 个
lastShareId: int = 0 💡 从此分享 id 之后开始,默认为 0,即从头开始
获取分享链接列表
GET https://open-api.123pan.com/api/v1/share/list
Reference
/API列表/分享管理/获取分享链接列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ixg0arldi61fe7av
- Payload:
limit: int = 100 💡 每页文件数量,最多 100 个
lastShareId: int = 0 💡 从此分享 id 之后开始,默认为 0,即从头开始
- share_list_payment(payload: dict | int = 100, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取付费分享链接列表
GET https://open-api.123pan.com/api/v1/share/payment/list
Reference
/API列表/分享管理/获取付费分享链接列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/mxc7eq2x3la72mwg
- Payload:
limit: int = 100 💡 每页文件数量,最多 100 个
lastShareId: int = 0 💡 从此分享 id 之后开始,默认为 0,即从头开始
获取付费分享链接列表
GET https://open-api.123pan.com/api/v1/share/payment/list
Reference
/API列表/分享管理/获取付费分享链接列表
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/mxc7eq2x3la72mwg
- Payload:
limit: int = 100 💡 每页文件数量,最多 100 个
lastShareId: int = 0 💡 从此分享 id 之后开始,默认为 0,即从头开始
- transcode_delete(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_delete(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
删除转码视频
POST https://open-api.123pan.com/api/v1/transcode/delete
Reference
/API列表/视频转码/删除视频/删除转码视频
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tg2xgotkgmgpulrp
- Payload:
fileId: int 💡 文件 id
businessType: int = 2 💡 业务类型:2:转码空间
trashed: int = 2 💡 删除范围:1:删除原文件 2:删除原文件+转码后的文件
- transcode_delete_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
删除转码视频
POST https://open-api.123pan.com/api/v1/transcode/delete
Reference
/API列表/视频转码/删除视频/删除转码视频
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tg2xgotkgmgpulrp
- Payload:
fileId: int 💡 文件 id
businessType: int = 2 💡 业务类型:2:转码空间
trashed: int = 2 💡 删除范围:1:删除原文件 2:删除原文件+转码后的文件
- transcode_download(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_download(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
原文件下载
POST https://open-api.123pan.com/api/v1/transcode/file/download
Reference
/API列表/视频转码/视频文件下载/原文件下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/mlltlx57sty6g9gf
- Payload:
fileId: int 💡 文件 id
- transcode_download_all(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_download_all(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
某个视频全部转码文件下载
POST https://open-api.123pan.com/api/v1/transcode/file/download/all
Attention
该接口需要轮询去查询结果,建议 10s 一次
Reference
/API列表/视频转码/视频文件下载/某个视频全部转码文件下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yb7hrb0x2gym7xic
- Payload:
fileId: int 💡 文件 id
zipName: str = f”转码{file_id}.zip” 💡 下载 zip 文件的名字
- transcode_download_all_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
某个视频全部转码文件下载
POST https://open-api.123pan.com/api/v1/transcode/file/download/all
Attention
该接口需要轮询去查询结果,建议 10s 一次
Reference
/API列表/视频转码/视频文件下载/某个视频全部转码文件下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yb7hrb0x2gym7xic
- Payload:
fileId: int 💡 文件 id
zipName: str = f”转码{file_id}.zip” 💡 下载 zip 文件的名字
- transcode_download_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
原文件下载
POST https://open-api.123pan.com/api/v1/transcode/file/download
Reference
/API列表/视频转码/视频文件下载/原文件下载
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/mlltlx57sty6g9gf
- Payload:
fileId: int 💡 文件 id
- transcode_info(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_info(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取转码空间文件夹信息
POST https://open-api.123pan.com/api/v1/transcode/folder/info
Reference
/API列表/视频转码/获取视频信息/获取转码空间文件夹信息
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kaalgke88r9y7nlt
- transcode_info_open(base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取转码空间文件夹信息
POST https://open-api.123pan.com/api/v1/transcode/folder/info
Reference
/API列表/视频转码/获取视频信息/获取转码空间文件夹信息
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kaalgke88r9y7nlt
- transcode_list(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_list(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
视频转码列表(三方挂载应用授权使用)
GET https://open-api.123pan.com/api/v1/video/transcode/list
Attention
此接口仅限授权
access_token调用Reference
/API列表/视频转码/获取视频信息/视频转码列表(三方挂载应用授权使用)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tgg6g84gdrmyess5
- Payload:
fileId: int 💡 文件 id
- transcode_list_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
视频转码列表(三方挂载应用授权使用)
GET https://open-api.123pan.com/api/v1/video/transcode/list
Attention
此接口仅限授权
access_token调用Reference
/API列表/视频转码/获取视频信息/视频转码列表(三方挂载应用授权使用)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tgg6g84gdrmyess5
- Payload:
fileId: int 💡 文件 id
- transcode_m3u8_ts_download(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_m3u8_ts_download(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
单个转码文件下载(m3u8或ts)
POST https://open-api.123pan.com/api/v1/transcode/m3u8_ts/download
Reference
/API列表/视频转码/视频文件下载/单个转码文件下载(m3u8或ts)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yf97p60yyzb8mzbr
- Payload:
fileId: int 💡 文件 id
resolution: str 💡 分辨率
type: int 💡 文件类型:1:m3u8 2:ts
tsName: str 💡 下载 ts 文件时必须要指定名称,请参考查询某个视频的转码结果
- transcode_m3u8_ts_download_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
单个转码文件下载(m3u8或ts)
POST https://open-api.123pan.com/api/v1/transcode/m3u8_ts/download
Reference
/API列表/视频转码/视频文件下载/单个转码文件下载(m3u8或ts)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/yf97p60yyzb8mzbr
- Payload:
fileId: int 💡 文件 id
resolution: str 💡 分辨率
type: int 💡 文件类型:1:m3u8 2:ts
tsName: str 💡 下载 ts 文件时必须要指定名称,请参考查询某个视频的转码结果
- transcode_record(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_record(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
查询某个视频的转码记录
POST https://open-api.123pan.com/api/v1/transcode/video/record
Reference
/API列表/视频转码/查询转码信息/查询某个视频的转码记录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ost1m82sa9chh0mc
- Payload:
fileId: int 💡 文件 id
- transcode_record_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
查询某个视频的转码记录
POST https://open-api.123pan.com/api/v1/transcode/video/record
Reference
/API列表/视频转码/查询转码信息/查询某个视频的转码记录
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/ost1m82sa9chh0mc
- Payload:
fileId: int 💡 文件 id
- transcode_resolutions(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_resolutions(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取视频文件可转码的分辨率
Attention
该接口需要轮询去查询结果,建议 10s 一次
POST https://open-api.123pan.com/api/v1/transcode/video/resolutions
Reference
/API列表/视频转码/获取视频信息/获取视频文件可转码的分辨率
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/apzlsgyoggmqwl36
- Payload:
fileId: int 💡 文件 id
- transcode_resolutions_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取视频文件可转码的分辨率
Attention
该接口需要轮询去查询结果,建议 10s 一次
POST https://open-api.123pan.com/api/v1/transcode/video/resolutions
Reference
/API列表/视频转码/获取视频信息/获取视频文件可转码的分辨率
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/apzlsgyoggmqwl36
- Payload:
fileId: int 💡 文件 id
- transcode_result(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_result(payload: dict | int | str, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
查询某个视频的转码结果
POST https://open-api.123pan.com/api/v1/transcode/video/result
Reference
/API列表/视频转码/查询转码信息/查询某个视频的转码结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/iucbqgge0dgfc8sv
- Payload:
fileId: int 💡 文件 id
- transcode_result_open(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
查询某个视频的转码结果
POST https://open-api.123pan.com/api/v1/transcode/video/result
Reference
/API列表/视频转码/查询转码信息/查询某个视频的转码结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/iucbqgge0dgfc8sv
- Payload:
fileId: int 💡 文件 id
- transcode_upload(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_upload(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
从云盘空间上传
POST https://open-api.123pan.com/api/v1/transcode/upload/from_cloud_disk
Reference
/API列表/视频转码/上传视频/云盘上传/从云盘空间上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tqy2xatoo4qmdbz7
- Payload:
fileId: list[FileID] 💡 云盘空间文件 id,最多 100 个
FileID = { "fileId": int # 文件 id }
- transcode_upload_open(payload: dict | int | str | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
从云盘空间上传
POST https://open-api.123pan.com/api/v1/transcode/upload/from_cloud_disk
Reference
/API列表/视频转码/上传视频/云盘上传/从云盘空间上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/tqy2xatoo4qmdbz7
- Payload:
fileId: list[FileID] 💡 云盘空间文件 id,最多 100 个
FileID = { "fileId": int # 文件 id }
- transcode_video(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- transcode_video(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
视频转码操作
POST https://open-api.123pan.com/api/v1/transcode/video
Reference
/API列表/视频转码/视频转码/视频转码操作
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xy42nv2x8wav9n5l
- Payload:
fileId: int 💡 文件 id
codecName: str 💡 编码方式
videoTime: int 💡 视频时长,单位:秒
resolutions: str 💡 要转码的分辨率(例如 1080P,P大写),多个用逗号,分隔连接,如:”2160P,1080P,720P”
- transcode_video_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
视频转码操作
POST https://open-api.123pan.com/api/v1/transcode/video
Reference
/API列表/视频转码/视频转码/视频转码操作
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xy42nv2x8wav9n5l
- Payload:
fileId: int 💡 文件 id
codecName: str 💡 编码方式
videoTime: int 💡 视频时长,单位:秒
resolutions: str 💡 要转码的分辨率(例如 1080P,P大写),多个用逗号,分隔连接,如:”2160P,1080P,720P”
- upload_complete(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_complete(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传完毕
POST https://open-api.123pan.com/upload/v1/file/upload_complete
Reference
/API列表/文件管理/上传/V1(旧)/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/hkdmcmvg437rfu6x
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- upload_complete_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传完毕
POST https://open-api.123pan.com/upload/v1/file/upload_complete
Reference
/API列表/文件管理/上传/V1(旧)/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/hkdmcmvg437rfu6x
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- upload_complete_v2(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_complete_v2(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传完毕
POST https://open-api.123pan.com/upload/v2/file/upload_complete
Reference
/API列表/文件管理/上传/V2(推荐)/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fzzc5o8gok517720
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- upload_complete_v2_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传完毕
POST https://open-api.123pan.com/upload/v2/file/upload_complete
Reference
/API列表/文件管理/上传/V2(推荐)/上传完毕
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fzzc5o8gok517720
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- upload_create(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_create(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建文件
POST https://open-api.123pan.com/upload/v1/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
开发者上传单文件大小限制 10 GB
不会重名
Note
/API列表/文件管理/上传/V1(旧)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/il16qi0opiel4889
请求创建文件接口,接口返回的 “reuse” 为 “true” 时,表示秒传成功,上传结束。
非秒传情况将会返回预上传ID
preuploadID与分片大小sliceSize,请将文件根据分片大小切分。
Reference
/API列表/文件管理/上传/V1(旧)/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/lrfuu3qe7q1ul8ig
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 }
- upload_create_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建文件
POST https://open-api.123pan.com/upload/v1/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
开发者上传单文件大小限制 10 GB
不会重名
Note
/API列表/文件管理/上传/V1(旧)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/il16qi0opiel4889
请求创建文件接口,接口返回的 “reuse” 为 “true” 时,表示秒传成功,上传结束。
非秒传情况将会返回预上传ID
preuploadID与分片大小sliceSize,请将文件根据分片大小切分。
Reference
/API列表/文件管理/上传/V1(旧)/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/lrfuu3qe7q1ul8ig
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 }
- upload_create_v2(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_create_v2(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
创建文件
POST https://open-api.123pan.com/upload/v2/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
开发者上传单文件大小限制 10 GB
不会重名
Note
/API列表/文件管理/上传/V2(推荐)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xogi45g7okqk7svr#uqhyW
调用创建文件接口,接口返回的 “reuse” 为 “true” 时,表示秒传成功,上传结束。
非秒传情况将会返回预上传ID
preuploadID与分片大小sliceSize,请将文件根据分片大小切分。非秒传情况下返回 “servers” 为后续上传文件的对应域名(重要),多个任选其一。
Reference
/API列表/文件管理/上传/V2(推荐)/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txow0iqviqsgotfl
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 "servers": list[str], # 上传地址,多个任选其一 }
- upload_create_v2_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
创建文件
POST https://open-api.123pan.com/upload/v2/file/create
Note
文件名要小于 256 个字符且不能包含以下字符:
"\/:*?|><文件名不能全部是空格
开发者上传单文件大小限制 10 GB
不会重名
Note
/API列表/文件管理/上传/V2(推荐)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xogi45g7okqk7svr#uqhyW
调用创建文件接口,接口返回的 “reuse” 为 “true” 时,表示秒传成功,上传结束。
非秒传情况将会返回预上传ID
preuploadID与分片大小sliceSize,请将文件根据分片大小切分。非秒传情况下返回 “servers” 为后续上传文件的对应域名(重要),多个任选其一。
Reference
/API列表/文件管理/上传/V2(推荐)/创建文件
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txow0iqviqsgotfl
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
- Returns:
返回的数据说明如下:
{ "fileID": str, # 上传后的文件 id。当已有相同 ``size`` 和 ``etag`` 的文件时,会发生秒传 "preuploadID": str, # 预上传 id。当 ``reuse`` 为 "true" 时,该字段不存在 "reuse": bool, # 是否秒传,返回 "true" 时表示文件已上传成功 "sliceSize": int, # 分片大小,必须按此大小生成文件分片再上传。当 ``reuse`` 为 "true" 时,该字段不存在 "servers": list[str], # 上传地址,多个任选其一 }
- upload_domain(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_domain(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取上传域名
GET https://open-api.123pan.com/upload/v2/file/domain
Reference
/API列表/文件管理/上传/V2(推荐)/获取上传域名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/agn8lolktbqie7p9
- Payload:
preuploadID: str 💡 预上传 id
- upload_domain_open(base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取上传域名
GET https://open-api.123pan.com/upload/v2/file/domain
Reference
/API列表/文件管理/上传/V2(推荐)/获取上传域名
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/agn8lolktbqie7p9
- Payload:
preuploadID: str 💡 预上传 id
- upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_file(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传文件
Note
如果文件名中包含字符
"\/:*?|><,则转换为对应的全角字符Reference
/API列表/文件管理/上传/V1(旧)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/il16qi0opiel4889
/API列表/视频转码/上传视频/本地上传/上传流程
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kh4ovskpumzn8r07
- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
preupload_id – 预上传 id,用于断点续传,提供此参数,则会忽略
file_md5、file_name、file_size、parent_id和duplicateslice_size – 分块大小,断点续传时,如果只上传过少于 2 个分块时,会被使用
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- upload_file_open(file: str | PathLike | URL | SupportsGeturl | Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], file_md5: str = '', file_name: str = '', file_size: int = -1, parent_id: int | str = 0, duplicate: Literal[0, 1, 2] = 0, preupload_id: None | str = None, slice_size: int = 0, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传文件
Note
如果文件名中包含字符
"\/:*?|><,则转换为对应的全角字符Reference
/API列表/文件管理/上传/V1(旧)/💡上传流程说明
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/il16qi0opiel4889
/API列表/视频转码/上传视频/本地上传/上传流程
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/kh4ovskpumzn8r07
- Parameters:
file –
待上传的文件
如果为
collections.abc.Buffer,则作为二进制数据上传如果为
filewrap.SupportsRead,则作为可读的二进制文件上传如果为
str或os.PathLike,则视为路径,打开后作为文件上传如果为
yarl.URL或http_request.SupportsGeturl(pip install python-http_request),则视为超链接,打开后作为文件上传如果为
collections.abc.Iterable[collections.abc.Buffer]或collections.abc.AsyncIterable[collections.abc.Buffer],则迭代以获取二进制数据,逐步上传
file_md5 – 文件的 MD5 散列值
file_name – 文件名
file_size – 文件大小
parent_id – 要上传的目标目录
duplicate – 处理同名:0: 提示/忽略 1: 保留两者 2: 替换
preupload_id – 预上传 id,用于断点续传,提供此参数,则会忽略
file_md5、file_name、file_size、parent_id和duplicateslice_size – 分块大小,断点续传时,如果只上传过少于 2 个分块时,会被使用
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
接口响应
- upload_list(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_list(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
列举已上传分片
POST https://open-api.123pan.com/upload/v1/file/list_upload_parts
Note
此接口用于罗列已经上传的分片信息,以供比对
Reference
/API列表/文件管理/上传/V1(旧)/列举已上传分片(非必需)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/dd28ws4bfn644cny
- Payload:
preuploadID: str 💡 预上传 id
- upload_list_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
列举已上传分片
POST https://open-api.123pan.com/upload/v1/file/list_upload_parts
Note
此接口用于罗列已经上传的分片信息,以供比对
Reference
/API列表/文件管理/上传/V1(旧)/列举已上传分片(非必需)
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/dd28ws4bfn644cny
- Payload:
preuploadID: str 💡 预上传 id
- upload_result(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_result(payload: str | dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
异步轮询获取上传结果
POST https://open-api.123pan.com/upload/v1/file/upload_async_result
Reference
/API列表/文件管理/上传/V1(旧)/异步轮询获取上传结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/qgcosr6adkmm51h7
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传合并是否完成,如果为 False,请至少 1 秒后再发起轮询 "fileID": int, # 上传的文件 id }
- upload_result_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
异步轮询获取上传结果
POST https://open-api.123pan.com/upload/v1/file/upload_async_result
Reference
/API列表/文件管理/上传/V1(旧)/异步轮询获取上传结果
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/qgcosr6adkmm51h7
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "completed": bool, # 上传合并是否完成,如果为 False,请至少 1 秒后再发起轮询 "fileID": int, # 上传的文件 id }
- upload_sha1_reuse(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_sha1_reuse(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
sha1哈希值文件上传
POST https://open-api.123pan.com/upload/v2/file/sha1_reuse
Note
文件名要小于 256 个字符且不能包含以下任何字符:
"\/:*?|><文件名不能全部是空格
Reference
/API列表/文件管理/上传/sha1哈希值文件上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/de0et33ct3uhdfqs
- Payload:
sha1: str 💡 文件 sha1
size: int 💡 文件大小,单位:字节
filename: str 💡 文件名,默认为 f”{sha1}-{size}”
parentFileID: int = 0 💡 父目录 id,根目录是 0
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
- Returns:
返回的数据说明如下:
{ "fileID": int, # 文件 ID。当 123 云盘已有该文件,则会发生秒传。此时会将文件 ID 字段返回。唯一 "reuse": bool, # 是否秒传,返回true时表示文件已上传成功 }
- upload_sha1_reuse_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
sha1哈希值文件上传
POST https://open-api.123pan.com/upload/v2/file/sha1_reuse
Note
文件名要小于 256 个字符且不能包含以下任何字符:
"\/:*?|><文件名不能全部是空格
Reference
/API列表/文件管理/上传/sha1哈希值文件上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/de0et33ct3uhdfqs
- Payload:
sha1: str 💡 文件 sha1
size: int 💡 文件大小,单位:字节
filename: str 💡 文件名,默认为 f”{sha1}-{size}”
parentFileID: int = 0 💡 父目录 id,根目录是 0
duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
- Returns:
返回的数据说明如下:
{ "fileID": int, # 文件 ID。当 123 云盘已有该文件,则会发生秒传。此时会将文件 ID 字段返回。唯一 "reuse": bool, # 是否秒传,返回true时表示文件已上传成功 }
- upload_single(payload: dict, /, file: Buffer | SupportsRead[Buffer] | Iterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_single(payload: dict, /, file: Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
单步上传
POST https://open-api.123pan.com/upload/v2/file/single/create
Note
文件名要小于 256 个字符且不能包含以下任何字符:
"\/:*?|><文件名不能全部是空格
请求头包含
Content-Type: multipart/form-data此接口限制开发者上传单文件大小为 1 GB
上传域名是
client.upload_domain_open响应中的域名此接口用于实现小文件单步上传一次 HTTP 请求交互即可完成上传
Reference
/API列表/文件管理/上传/V2(推荐)/单步上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xhiht1uh3yp92pzc
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
file: Any 💡 分片二进制流(请单独传递
file参数)
- Returns:
返回的数据说明如下:
{ "completed": bool, # 是否上传完成(如果 "completed" 为 "true" 时,则说明上传完成) "fileID": int, # 文件 ID。当 123 云盘已有该文件,则会发生秒传。此时会将文件 ID 字段返回。唯一 }
- upload_single_open(payload: dict, /, file: Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
单步上传
POST https://open-api.123pan.com/upload/v2/file/single/create
Note
文件名要小于 256 个字符且不能包含以下任何字符:
"\/:*?|><文件名不能全部是空格
请求头包含
Content-Type: multipart/form-data此接口限制开发者上传单文件大小为 1 GB
上传域名是
client.upload_domain_open响应中的域名此接口用于实现小文件单步上传一次 HTTP 请求交互即可完成上传
Reference
/API列表/文件管理/上传/V2(推荐)/单步上传
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/xhiht1uh3yp92pzc
- Payload:
containDir: bool = False 💡 上传文件是否包含路径
filename: str 💡 文件名,但
containDir为 “true” 时,视为路径duplicate: 0 | 1 | 2 = 0 💡 处理同名:0: 跳过/报错 1: 保留/后缀编号 2: 替换/覆盖
etag: str 💡 文件 md5
parentFileID: int = 0 💡 父目录 id,根目录是 0
size: int 💡 文件大小,单位:字节
file: Any 💡 分片二进制流(请单独传递
file参数)
- Returns:
返回的数据说明如下:
{ "completed": bool, # 是否上传完成(如果 "completed" 为 "true" 时,则说明上传完成) "fileID": int, # 文件 ID。当 123 云盘已有该文件,则会发生秒传。此时会将文件 ID 字段返回。唯一 }
- upload_slice(payload: dict, /, slice: Buffer | SupportsRead[Buffer] | Iterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_slice(payload: dict, /, slice: Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
上传文件文件
POST https://open-api.123pan.com/upload/v2/file/slice
Note
上传域名是创建文件接口响应中的 “servers”
请求头包含
Content-Type: multipart/form-data
Reference
/API列表/文件管理/上传/V2(推荐)/上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txow0iqviqsgotfl
- Payload:
preuploadID: str 💡 预上传ID
sliceNo: int 💡 分片序号,从 1 开始自增
sliceMD5: str 💡 当前分片 md5
slice: Any 💡 分片二进制流(请单独传递
slice参数)
- upload_slice_open(payload: dict, /, slice: Buffer | SupportsRead[Buffer] | Iterable[Buffer] | AsyncIterable[Buffer], base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
上传文件文件
POST https://open-api.123pan.com/upload/v2/file/slice
Note
上传域名是创建文件接口响应中的 “servers”
请求头包含
Content-Type: multipart/form-data
Reference
/API列表/文件管理/上传/V2(推荐)/上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/txow0iqviqsgotfl
- Payload:
preuploadID: str 💡 预上传ID
sliceNo: int 💡 分片序号,从 1 开始自增
sliceMD5: str 💡 当前分片 md5
slice: Any 💡 分片二进制流(请单独传递
slice参数)
- upload_url(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- upload_url(payload: dict, /, base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取上传地址&上传分片
POST https://open-api.123pan.com/upload/v1/file/get_upload_url
Note
有多个分片时,轮流分别根据序号获取下载链接,然后 PUT 方法上传分片。由于上传链接会过期,所以没必要提前获取一大批
Reference
/API列表/文件管理/上传/V1(旧)/获取上传地址&上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sonz9n085gnz0n3m
- Payload:
preuploadID: str 💡 预上传 id
sliceNo: int 💡 分片序号,从 1 开始自增
- upload_url_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取上传地址&上传分片
POST https://open-api.123pan.com/upload/v1/file/get_upload_url
Note
有多个分片时,轮流分别根据序号获取下载链接,然后 PUT 方法上传分片。由于上传链接会过期,所以没必要提前获取一大批
Reference
/API列表/文件管理/上传/V1(旧)/获取上传地址&上传分片
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/sonz9n085gnz0n3m
- Payload:
preuploadID: str 💡 预上传 id
sliceNo: int 💡 分片序号,从 1 开始自增
- user_info(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[False] = False, **request_kwargs) dict[source]#
- user_info(base_url: str | Callable[[], str] = DEFAULT_OPEN_BASE_URL, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]
获取用户信息
GET https://open-api.123pan.com/api/v1/user/info
Reference
/API列表/用户管理/获取用户信息
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fa2w0rosunui2v4m
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }
- user_info_open(base_url: str | Callable[[], str] = 'https://open-api.123pan.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]#
获取用户信息
GET https://open-api.123pan.com/api/v1/user/info
Reference
/API列表/用户管理/获取用户信息
https://123yunpan.yuque.com/org-wiki-123yunpan-muaork/cr6ced/fa2w0rosunui2v4m
- Payload:
preuploadID: str 💡 预上传 id
- Returns:
返回的数据说明如下:
{ "async": bool, # 是否需要异步查询上传结果 "completed": bool, # 上传是否完成 "fileID": int, # 上传的文件 id }