62 lines
1.5 KiB
Plaintext
62 lines
1.5 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": 4,
|
|
"id": "e8d05784",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"for i in range(1,5):\n",
|
|
" post(f\"https://band.hxzhxy.cn/uc/class/add?access_token={token}\",json={\"gradeId\":128,\"teamId\":119,\"className\":f\"{i}班\",\"enabled\":True})"
|
|
]
|
|
}
|
|
],
|
|
"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
|
|
}
|