Qilan2 commited on
Commit
fdc2216
·
verified ·
1 Parent(s): 3b4d453

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +7 -8
server.py CHANGED
@@ -288,19 +288,18 @@ def check_api1():
288
  if Service_status:
289
  print("结束检测")
290
  break
291
- url = f"{st_url}/login" # 确保这个 URL 是正确的
292
  try:
293
  response = requests_retry_session().get(url, timeout=30)
294
  response.raise_for_status() # 检查响应状态
295
- # 获取响应内容
296
- response_text = response.text # 获取 HTML 内容
297
- print("接口返回信息:", response_text)
298
- # 模糊查找注册账号相关信息
299
- if "注册" in response_text or "账号" in response_text:
300
- print("检测到注册账号相关信息,结束检测")
301
  break # 跳出循环
302
  else:
303
- print("接口返回信息:", response_text)
304
 
305
  # except requests.exceptions.HTTPError as e:
306
  # if e.response.status_code == 403:
 
288
  if Service_status:
289
  print("结束检测")
290
  break
291
+ url = f"{st_url}//csrf-token" # 确保这个 URL 是正确的
292
  try:
293
  response = requests_retry_session().get(url, timeout=30)
294
  response.raise_for_status() # 检查响应状态
295
+ # 尝试解析 JSON 响应
296
+ response_json = response.json() # 获取 JSON 内容
297
+ print("接口返回信息:", response_json)
298
+ if "token" in response_json:
299
+ print("检测到 token,结束检测")
 
300
  break # 跳出循环
301
  else:
302
+ print("接口返回信息:", response_json)
303
 
304
  # except requests.exceptions.HTTPError as e:
305
  # if e.response.status_code == 403: