feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现 - 添加图片压缩工具和快速压缩脚本 - 实现学生信息处理相关API - 添加MQTT客户端和消息处理功能 - 更新.gitignore忽略更多文件类型 - 添加数据库操作工具和示例 - 实现多个测试脚本和工具类
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
from requests import get, post, put, delete
|
||||
import random
|
||||
|
||||
|
||||
# v1.jinrishici.com/all.json
|
||||
def apiSentence():
|
||||
data = get("https://v1.hitokoto.cn").json()
|
||||
return data
|
||||
|
||||
|
||||
def cat():
|
||||
data = get("https://api.thecatapi.com/v1/images/search?size=full").json()
|
||||
result = data[0]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def dog():
|
||||
data = get("https://api.thedogapi.com/v1/images/search?size=full").json()
|
||||
result = data[0]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def pic():
|
||||
data = get("https://api.vvhan.com/api/bing?type=json&rand=sj").json()
|
||||
result = data["data"]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def randomPic():
|
||||
func = random.choice([cat])
|
||||
data = func()
|
||||
return data
|
||||
|
||||
|
||||
def getEmoji():
|
||||
data = get("https://api.vvhan.com/api/emoji?type=json").json()
|
||||
return data
|
||||
|
||||
|
||||
def getShi():
|
||||
data = post("http://v1.jinrishici.com/all.json").json()
|
||||
return data
|
||||
+69
-78
@@ -3,108 +3,99 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "cc3ee99d",
|
||||
"id": "39b16c44",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import * "
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"ip = \"http://192.168.0.209:8100\"\n",
|
||||
"param = {\n",
|
||||
" \"username\": \"tangchao\",\n",
|
||||
" \"password\": \"123456a\",\n",
|
||||
" \"client_id\": \"client\",\n",
|
||||
" \"grant_type\": \"password\",\n",
|
||||
" \"client_secret\": \"123456\",\n",
|
||||
"}\n",
|
||||
"data = get(url=f\"{ip}/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456\").json()\n",
|
||||
"token = data[\"access_token\"]\n",
|
||||
"header = {\n",
|
||||
" \"content-type\": \"application/json\",\n",
|
||||
" \"authorization\": f\"Bearer {token}\",\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 42,
|
||||
"id": "5af4df03",
|
||||
"execution_count": 16,
|
||||
"id": "9f7ca2db",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for i in [\"233157541\",\"233157542\",\"233157544\",\"233157545\",\"233157546\"]:\n",
|
||||
" get(f\"http://139.159.182.121:8092/card/getTime?controllerSN={i}\")"
|
||||
"access_token = post(\"https://szihj.idsp.yunxiao.com/Open/Access/GetToken\",params={\n",
|
||||
" \"corpId\": \"869376250979578017\",\n",
|
||||
" \"corpSecret\": \"GQSYGTLMKNJHVLHZMHYDMHATIGTTOBYP\"\n",
|
||||
" }).json()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "8d2a2506",
|
||||
"execution_count": 18,
|
||||
"id": "83ed8c86",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data={\"name\":\"测试\",\"endDate\":1759161600000,\"content\":None,\"userType\":1,\"dateState\":\"0\",\"userIds\":[130,163,195,196,198,197,161,446,226,507,535,162,106,176,206,105,116,204,222,510,508,509,523,200,135,513,208,164,210,512,207,527,447,521,212,118,450,139,437,177,179,514,515,107,102,219,530,108,187,147,126,189,110,458,462,457,528,143,124,217,448,525,526,550,517,113,534,541,320,150,456,540,524,522,529,186,105,140,151,689,166,151,521,520,805,130],\"status\":0,\"type\":6,\"userName\":\"钟伟\",\"userId\":473,\"teamId\":19}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "e69ccb4b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"demo1.docx\",\"rb\") as f:\n",
|
||||
" file = f.read()"
|
||||
"token= access_token[\"access_token\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1c7bc78e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"success\":false,\"msg\":\"文件太大\",\"code\":10004,\"data\":null}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"post(f\"{ip}/word/process/convert\",files={\"file\":(\n",
|
||||
" \"demo1.docx\",\n",
|
||||
" file, 'application/octet-stream'\n",
|
||||
")},headers=header).text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"id": "eeed45e5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"success\":false,\"msg\":\"Transaction was marked for rollback only; cannot commit; nested exception is org.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit\",\"code\":10000,\"data\":null}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"post(f\"{ip}/applicatonTitle/add\",json=data,headers=header).text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "20286e94",
|
||||
"id": "0463e46a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"HttpHeaders httpHeaders = new HttpHeaders();\n",
|
||||
" HttpEntity<String> httpEntity = new HttpEntity<String>(null, httpHeaders);\n",
|
||||
" String url = synchronizationStudentOpenByTeamIdAndType.getAddress() + \"?corpId=\" + synchronizationStudentToken.getCorpId() + \"&corpSecret=\" + synchronizationStudentToken.getCorpSecret();\n",
|
||||
" RestTemplate restTemplateHttps = new RestTemplate(RestTemplateConfig.getHttpComponentsClientHttpRequestFactory());\n",
|
||||
" ResponseEntity<String> results = restTemplateHttps.exchange(url, HttpMethod.POST, httpEntity, String.class);\n",
|
||||
" JSONObject json = JSON.parseObject(results.getBody());\n",
|
||||
" System.out.println(\"access_token-----json-----:\"+json);"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "98f9d828",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"header={\n",
|
||||
" \"Authorization\": token\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"id": "bc1d9df5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"errcode\":0,\"errmsg\":\"ok\",\"data\":[]}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"get(\"https://szihj.idsp.yunxiao.com/Open/Leave/GetLeaveList\",headers=header).text\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d8bfe363",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "base",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python",
|
||||
"version": "3.12.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user