Code refactoring and optimization: remove duplicate code, simplify grade processing logic, and improve code readability and maintainability.

This commit is contained in:
NianBroken
2024-05-06 19:04:10 +08:00 Unverified
parent c9f5433005
commit 91344e99ab
7 changed files with 254 additions and 210 deletions
+6 -1
View File
@@ -8,5 +8,10 @@ def send_message(token, title, content):
body = json.dumps(data).encode(encoding="utf-8")
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=body, headers=headers)
# 解析 JSON 数据
response_dict = json.loads(response.text)
# 删除 "data" 字段
if "data" in response_dict:
response_dict.pop("data")
return response.text
return response_dict