{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import time\n",
    "from time import sleep\n",
    "import json\n",
    "import os\n",
    "\n",
    "token='###'\n",
    "cookies = {\n",
    "\"JSESSIONID\": \"###\",\n",
    "\"_csrf\": \"###\",\n",
    "\"_pv0\": \"###\",\n",
    "\"_pf0\": \"###\",\n",
    "\"_pm0\":\"###\",\n",
    "\"_pc0\": \"###\",\n",
    "\"stu-token\": token\n",
    "}\n",
    "def get_current_timestamp():\n",
    "    # 获取当前时间的时间戳，单位为毫秒\n",
    "    return int(time.time() * 1000)\n",
    "\n",
    "def xsgf():\n",
    "    timestamp = get_current_timestamp()\n",
    "    payload = f\"t={timestamp}&type=xsgf&value=100&active=8\"\n",
    "    headers = {\n",
    "        \"Accept\": \"application/json, text/plain, */*\",\n",
    "        \"Accept-Encoding\": \"gzip, deflate\",\n",
    "        \"Accept-Language\": \"en-US,en;q=0.9\",\n",
    "        \"Connection\": \"keep-alive\",\n",
    "        \"Content-Length\": \"0\",\n",
    "        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36\",\n",
    "        \"Origin\": \"http://regi.zju.edu.cn\",\n",
    "        \"Token\": token\n",
    "    }\n",
    "\n",
    "            # 发送POST请求\n",
    "    response = requests.get(f'http://regi.zju.edu.cn/grs-pro/stu/processinfo/updateInfo?t={timestamp}&type=xsgf&value=100&active=8', data=payload, headers=headers,cookies=cookies)\n",
    "    print(str(response.content,encoding='utf-8'))\n",
    "def aqcs():\n",
    "    timestamp = get_current_timestamp()\n",
    "    payload = f\"t={timestamp}&type=aqcs&value=100&active=10\"\n",
    "    headers = {\n",
    "        \"Accept\": \"application/json, text/plain, */*\",\n",
    "        \"Accept-Encoding\": \"gzip, deflate\",\n",
    "        \"Accept-Language\": \"en-US,en;q=0.9\",\n",
    "        \"Connection\": \"keep-alive\",\n",
    "        \"Content-Length\": \"0\",\n",
    "        \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36\",\n",
    "        \"Origin\": \"http://regi.zju.edu.cn\",\n",
    "        \"Token\": token\n",
    "    }\n",
    "            # 发送POST请求\n",
    "    response = requests.get(f'http://regi.zju.edu.cn/grs-pro/stu/processinfo/updateInfo?t={timestamp}&type=aqcs&value=100&active=10', data=payload, headers=headers,cookies=cookies)\n",
    "    print(str(response.content,encoding='utf-8'))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"msg\":\"操作成功！\",\"code\":0}\n"
     ]
    }
   ],
   "source": [
    "aqcs()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"msg\":\"操作成功！\",\"code\":0}'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xsgf()"
   ]
  }
 ],
 "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.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
