-
Notifications
You must be signed in to change notification settings - Fork 198
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 #408 from WittF/main
添加Server酱推送
- Loading branch information
Showing
5 changed files
with
75 additions
and
24 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
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")) |