Files
python----/智慧校园/本地/demo.ipynb
T
admin aac9f5934d feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现
- 添加图片压缩工具和快速压缩脚本
- 实现学生信息处理相关API
- 添加MQTT客户端和消息处理功能
- 更新.gitignore忽略更多文件类型
- 添加数据库操作工具和示例
- 实现多个测试脚本和工具类
2026-04-13 14:47:50 +08:00

3.3 KiB

In [1]:
from requests import get,post
import time
ip = "http://192.168.0.209:8100"
param = {
    "username": "tangchao",
    "password": "123456a",
    "client_id": "client",
    "grant_type": "password",
    "client_secret": "123456",
}
data = get(url=f"{ip}/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456").json()
token = data["access_token"]
header = {
    "content-type": "application/json",
    "authorization": f"Bearer {token}",
}
In [16]:
access_token = post("https://szihj.idsp.yunxiao.com/Open/Access/GetToken",params={
    "corpId": "869376250979578017",
    "corpSecret": "GQSYGTLMKNJHVLHZMHYDMHATIGTTOBYP"
    }).json()
In [18]:
token= access_token["access_token"]
In [ ]:
HttpHeaders httpHeaders = new HttpHeaders();
                  HttpEntity<String> httpEntity = new HttpEntity<String>(null, httpHeaders);
                  String url = synchronizationStudentOpenByTeamIdAndType.getAddress()  + "?corpId=" + synchronizationStudentToken.getCorpId() + "&corpSecret=" + synchronizationStudentToken.getCorpSecret();
                  RestTemplate restTemplateHttps = new RestTemplate(RestTemplateConfig.getHttpComponentsClientHttpRequestFactory());
                  ResponseEntity<String> results = restTemplateHttps.exchange(url, HttpMethod.POST, httpEntity, String.class);
                  JSONObject json = JSON.parseObject(results.getBody());
                  System.out.println("access_token-----json-----:"+json);
In [19]:
header={
    "Authorization": token
}
In [21]:
get("https://szihj.idsp.yunxiao.com/Open/Leave/GetLeaveList",headers=header).text
Out [21]:
'{"errcode":0,"errmsg":"ok","data":[]}'