Files
python----/智慧校园/本部/建班级.ipynb
T
2025-10-20 12:32:18 +08:00

138 lines
3.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "87b031d3",
"metadata": {},
"outputs": [],
"source": [
"from requests import get,post\n",
"import time\n",
"ip = \"http://band.hxzhxy.cn\"\n",
"param = {\n",
" \"username\": \"zhongwei\",\n",
" \"password\": \"123456a\",\n",
" \"client_id\": \"client\",\n",
" \"grant_type\": \"password\",\n",
" \"client_secret\": \"123456\",\n",
"}\n",
"data = get(url=f\"http://band.hxzhxy.cn/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": 2,
"id": "e8d05784",
"metadata": {},
"outputs": [],
"source": [
"for i in range(1,19):\n",
" post(f\"https://band.hxzhxy.cn/uc/class/add?access_token={token}\",json={\"gradeId\":124,\"teamId\":19,\"className\":f\"导师{i}班\",\"enabled\":True})"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4e2bc4f9",
"metadata": {},
"outputs": [],
"source": [
"区域1 = [4465-4433,4432-4400,4612-4464,4372-4352,4400-4372]\n",
"区域中间 = [4352-4304]\n",
"区域右上 = [4260-4236,4268-4260,4236-4216,4216-4196,4276-4268,4196-4180,4180-4172,4304-4276,4172-4156,4776-4664]\n",
"区域右下 = [4048-4000,4664-4612,4120-4048,4156-4120]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "3218ab3e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[32, 32, 148, 20, 28] [48] [24, 8, 20, 20, 8, 16, 8, 28, 16, 112] [48, 52, 72, 36]\n"
]
}
],
"source": [
"print(区域1,区域中间,区域右上,区域右下)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "a6ac5331",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"260\n",
"48\n",
"260\n",
"208\n"
]
}
],
"source": [
"print(sum(区域1))\n",
"print(sum(区域中间))\n",
"print(sum(区域右上))\n",
"print(sum(区域右下))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "13a25604",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"776"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(区域1)+sum(区域中间)+sum(区域右上)+sum(区域右下)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}