diff --git a/fn_print.py b/fn_print.py new file mode 100644 index 0000000..4ca5597 --- /dev/null +++ b/fn_print.py @@ -0,0 +1,23 @@ +# -*- coding=UTF-8 -*- +# @Project QL_TimingScript +# @fileName fn_print.py +# @author Echo +# @EditTime 2024/9/24 +from typing import * + +all_print_list = [] + + +def fn_print(*args, sep=' ', end='\n', **kwargs): + global all_print_list + output = "" + # 构建输出字符串 + for index, arg in enumerate(args): + if index == len(args) - 1: + output += str(arg) + continue + output += str(arg) + sep + output = output + end + all_print_list.append(output) + # 调用内置的 print 函数打印字符串 + print(*args, sep=sep, end=end, **kwargs) diff --git a/sendNotify.py b/sendNotify.py index 583f585..6c36650 100644 --- a/sendNotify.py +++ b/sendNotify.py @@ -3,7 +3,6 @@ # @fileName sendNotify.py # @author Echo # @EditTime 2024/9/13 -from curses.ascii import FS import sys import os, re import requests @@ -16,6 +15,8 @@ import urllib.parse from requests.adapters import HTTPAdapter from urllib3.util import Retry +from fn_print import all_print_list + cur_path = os.path.abspath(os.path.dirname(__file__)) root_path = os.path.split(cur_path)[0] sys.path.append(root_path) @@ -465,7 +466,6 @@ def send(title, content): continue else: print('此类推送方式不存在') - print("xxxxxxxxxxxx") def main(): @@ -477,7 +477,15 @@ def send_notification_message(title, content): dingding_bot(title, content) except Exception as e: print("发送通知消息失败") - + + +def send_notification_message_collection(title): + try: + send(title, ''.join(all_print_list)) + except Exception as e: + if e: + print('发送通知消息失败!') + async def aysnc_send_notification_message(title, content): try: