This release is a pre-release and may not be stable for production use.
腾讯文档 API SDK
根据《腾讯文档——开发文档》实现了 API 接口。
请区分腾讯文档和企业微信文档,前者域名 docs.qq.com,后者域名是 doc.weixin.qq.com
功能特点:
- token 有 cache
- 基本接口有封装
- 合并接口封装,比如单接口实现上传文档等
安装
pip install qq-doc
上传 xlsx 文件并转换的示例
Demo 中有 xlsx 的文档上传到指定目录下的示例,需要替换自己的 client_id 和 client_secret。
from qq_doc import QQDocAPI
client_id = "your_client_id"
client_secret = "your_client_secret"
folder_name = "test"
filename = "test.xlsx"
api = QQDocAPI(client_id, client_secret)
folder = api.create_folder_if_not_exist(folder_name)
new_file = api.upload_file(filename, folder["ID"])
# 加一个公开写权限,也可以使用publicRead, private, members
api.set_file_permission(new_file["ID"], "publicWrite")
print(new_file)
注意:腾讯文档支持同名文件的存在,所以如果多次执行,会产生多个文件,他们的ID不同,但是命名相同。请记得清理
接口实现情况
文件操作
| 接口 | 方法名称 |
|---|---|
| 新建文档 | |
| 查询文档 | |
| 重命名文档 | |
| 移动文档 | |
| 删除文档 | delete_folder |
| 生成副本 | |
| 收藏文档 | |
| 置顶文档 | |
| 设置水印 | |
| 创建快捷方式 | |
| 恢复文档 |
导入文件
| 接口 | 方法名称 |
|---|---|
| 预导入文档 | create_import_info |
| 异步导入文档 | async_import_document |
| 查询导入进度 | get_import_progress |
| [封装]同步导入文档 | upload_file |
导出文件
| 接口 | 方法名称 |
|---|---|
| 导出文档 | |
| 导出进度查询 |
文件夹操作
| 接口 | 方法名称 |
|---|---|
| 获取文档列表 | list_folder_contents |
| 查询文件夹信息 | get_folder_metadata |
| [封装]根据文件名获得文件列表 | get_folder_by_name |
| 添加文件夹 | create_folder |
| [封装]创建文件夹如果不存在 | create_folder_if_not_exist |
| 删除文件夹 | delete_folder |
| 查询文件夹权限 | |
| 移动文件夹 | |
| 重命名文件夹 |
文档权限
| 接口 | 方法名称 |
|---|---|
| 查询用户访问权限 | get_file_access |
| 转让文档所有权 | |
| 查看文档权限 | get_file_permission |
| 设置文档权限 | set_file_permission |
| 申请文档权限 | |
| 添加协作成员 | add_collaborators |
| 移除协作成员 | |
| 查询协作成员 | get_collaborators |
搜索
| 接口 | 方法名称 |
|---|---|
| 列表过滤 | |
| 关键字搜索 |
功能接口
| 接口 | 方法名称 |
|---|---|
| fileID 转换 | |
| 上传图片 |
通知
| 接口 | 方法名称 |
|---|---|
| 查询消息列表未读数量 |
Metadata
Release files for qq-doc 0.1.0.dev3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qq_doc-0.1.0.dev3.tar.gz | 8.9 kB | Without provenance | Details for qq_doc-0.1.0.dev3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qq_doc-0.1.0.dev3-py3-none-any.whl | Python 3 | none | any | Details for qq_doc-0.1.0.dev3-py3-none-any.whl |
Total release size: 17.5 kB
Release files / qq_doc-0.1.0.dev3.tar.gz
| Download URL | qq_doc-0.1.0.dev3.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
073b3c74c2c4088030b255efed842463db3160011396bbfffa80973e5880fa79
|
|
BLAKE2b-256 checksum How to use checksums |
be4c5fe153372c91b11cbe650eb529ff2076b827f81d04c692052d4433ccc1e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / qq_doc-0.1.0.dev3-py3-none-any.whl
| Download URL | qq_doc-0.1.0.dev3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5da7e5fc9a68a6a6bbd7a2eacf18bf186e7b99a7cc22dbf87f0c25375ad903cb
|
|
BLAKE2b-256 checksum How to use checksums |
2694eaadaaaa1cc4a0d0c4df467ef71825c3f809295bf37a19398eba132ec166
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Security for qq-doc 0.1.0.dev3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.