Optimized code

This commit is contained in:
NianBroken
2024-01-30 23:51:00 +08:00 Unverified
parent 1beed0de80
commit 8786eb04f6
2 changed files with 2 additions and 3 deletions
+1
View File
@@ -10,6 +10,7 @@ from pushplus import send_message
url = os.environ.get("URL") url = os.environ.get("URL")
username = os.environ.get("USERNAME") username = os.environ.get("USERNAME")
password = os.environ.get("PASSWORD") password = os.environ.get("PASSWORD")
token = os.environ.get("TOKEN")
# 定义一个md5加密的封装函数 # 定义一个md5加密的封装函数
+1 -3
View File
@@ -1,10 +1,8 @@
import requests import requests
import json import json
import os
def send_message(title, content): def send_message(token, title, content):
token = os.environ.get("TOKEN")
url = "http://www.pushplus.plus/send" url = "http://www.pushplus.plus/send"
data = {"token": token, "title": title, "content": content} data = {"token": token, "title": title, "content": content}
body = json.dumps(data).encode(encoding="utf-8") body = json.dumps(data).encode(encoding="utf-8")