-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from WittF/main
添加Server酱推送,重命名PushPlusUtil
- Loading branch information
Showing
7 changed files
with
71 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import json | ||
|
||
import loguru | ||
import requests | ||
import playsound | ||
import os | ||
|
||
from config import get_application_tmp_path | ||
|
||
|
||
def send_message(token, desp, title): | ||
try: | ||
url = f"https://sctapi.ftqq.com/{token}.send" | ||
headers = { | ||
"Content-Type": "application/json" | ||
} | ||
|
||
data = { | ||
"desp": desp, | ||
"title": title | ||
} | ||
requests.post(url, headers=headers, data=json.dumps(data)) | ||
except Exception as e: | ||
loguru.logger.info("ServerChan消息发送失败") | ||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
playsound.playsound(os.path.join(get_application_tmp_path(), "default.mp3")) |