feat: 添加多个功能模块和工具脚本

- 新增websocket客户端和服务端实现
- 添加图片压缩工具和快速压缩脚本
- 实现学生信息处理相关API
- 添加MQTT客户端和消息处理功能
- 更新.gitignore忽略更多文件类型
- 添加数据库操作工具和示例
- 实现多个测试脚本和工具类
This commit is contained in:
2026-04-13 14:47:50 +08:00
parent 2cfd7c5a08
commit aac9f5934d
87 changed files with 216279 additions and 6519 deletions
+85 -3
View File
@@ -11,12 +11,12 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"headers = {\n",
" \"authorization\":\"Bearer czs_h7L9OSgejkWbzwau7RfDzO35tWFNnXA3URoe1xtz1WYhyvfxDWuUTDhUGHPREjBxn\",\n",
" \"authorization\":\"Bearer pat_OHegGl8V4T04IUBZ9KRoldFHKegGX48kQKTfyskZJWMRUbQMNHD0AuqGtvGYZ0q9\",\n",
" \"content-type\":\"application/json\"\n",
"}\n",
"ip = \"https://api.coze.cn\""
@@ -24,13 +24,61 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"code\":700012006,\"msg\":\"access token expired\"}\n"
]
}
],
"source": [
"data = post(\"https://api.coze.cn/open_api/knowledge/document/list\",headers=headers,json={\"dataset_id\":\"7567253415145144335\"}).text\n",
"print(data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"data = get(f\"{ip}/v1/conversation/message/list?conversation_id=7483161006881980479\",json={\"limit\":20},headers=headers).json()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"ename": "AttributeError",
"evalue": "'str' object has no attribute 'iter_lines'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[24], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m data\u001b[38;5;241m.\u001b[39miter_lines():\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m line:\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(line\u001b[38;5;241m.\u001b[39mdecode(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mutf-8\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n",
"\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'iter_lines'"
]
}
],
"source": [
"for line in data.iter_lines():\n",
" if line:\n",
" print(line.decode(\"utf-8\")) # 处理每一行数据"
]
},
{
"cell_type": "code",
"execution_count": 15,
@@ -238,6 +286,40 @@
")\n",
"print(data.text)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import json"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"code\":700012006,\"msg\":\"cannot get access token from Authorization header\"}\n"
]
}
],
"source": [
"data = post(f\"https://api.coze.cn/open_api/knowledge/document/delete\",json={\"document_ids\":[\"7567325098534502435\"]},headers=headers)\n",
"print(data.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {