From 3b0ff5e780301a845ca93369f3dfa1a8aa6cb4aa Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 09:47:52 +0000 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=94=A5=E6=B7=BB=E5=8A=A0pushdeer?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E9=80=A0=E8=BD=AE=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index e839041..3e17502 100755 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ pycryptodome==3.17 requests~=2.25.1 rsa~=4.0 urllib3~=1.26.2 +pypushdeer==0.0.3 From a3f363056348acaec3a80284cb0b289df1a2c5d0 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 09:48:22 +0000 Subject: [PATCH 2/8] =?UTF-8?q?ruff=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruff.toml | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 ruff.toml diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..08e40b1 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,78 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +# Same as Black. +line-length = 320 +indent-width = 4 + +# Assume Python 3.11 +target-version = "py311" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" +# quote-style = "single" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = true + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" From 92362e6c654620e17e0ec67a9b3c14dc3fe666c6 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 09:50:27 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=94=A5=E6=96=B0=E5=A2=9EWXpusher?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=EF=BC=8CPushDeer=E9=80=9A=E7=9F=A5=E6=B8=A0?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/configs.py | 3 + dailycheckin/utils/message.py | 142 ++++++++++++++++++---------------- 2 files changed, 79 insertions(+), 66 deletions(-) diff --git a/dailycheckin/configs.py b/dailycheckin/configs.py index b8c0da1..f572933 100755 --- a/dailycheckin/configs.py +++ b/dailycheckin/configs.py @@ -16,6 +16,9 @@ def checkin_map(): checkin_map = checkin_map() notice_map = { + "PUSHKEY": "", + "WXPUSHER_TK": "", + "WXPUSHER_UID": "", "BARK_URL": "", "COOLPUSHEMAIL": "", "COOLPUSHQQ": "", diff --git a/dailycheckin/utils/message.py b/dailycheckin/utils/message.py index f92795a..3df9cb1 100755 --- a/dailycheckin/utils/message.py +++ b/dailycheckin/utils/message.py @@ -7,36 +7,57 @@ from urllib.parse import quote_plus import requests +from pypushdeer import PushDeer + + +def message2pushdeer(pushkey: str, content: str): # 效果展示 https://pic2.ziyuan.wang/user/fansir/2024/05/1715593565981_39b4eff978354.png + print("PushDeer 推送开始") + pushdeer = PushDeer(pushkey=pushkey) + pushdeer.send_text(content, desp="dailycheckin 每日签到") + + +def message2wxpuser(wxpuser_tk: str, wxpusher_uid: str, content: str): # 效果展示 https://pic2.ziyuan.wang/user/fansir/2024/05/1715593114657_e53ec9acf7e1e.png + print("wxpuser 推送开始") + url = "https://wxpusher.zjiecode.com/api/send/message" + headers = {"Content-Type": "application/json"} + content = content.replace("\n", "
") + data = f'

每日签到


{content}


' + _uid = [wxpusher_uid] + _body = { + "appToken": wxpuser_tk, # 必传 + "content": data, # 必传 + "summary": "dailycheckin 每日签到", + "contentType": 2, + "uids": _uid, + "verifyPayType": 0, + } + res = requests.post(url=url, headers=headers, json=_body).json() + print(res) + def message2server(sckey, content): print("server 酱推送开始") data = {"text": "每日签到", "desp": content.replace("\n", "\n\n")} - requests.post(url=f"https://sc.ftqq.com/{sckey}.send", data=data) + requests.post(url=f"https:#sc.ftqq.com/{sckey}.send", data=data) return def message2server_turbo(sendkey, content): print("server 酱 Turbo 推送开始") data = {"text": "每日签到", "desp": content.replace("\n", "\n\n")} - requests.post(url=f"https://sctapi.ftqq.com/{sendkey}.send", data=data) + requests.post(url=f"https:#sctapi.ftqq.com/{sendkey}.send", data=data) return -def message2coolpush( - coolpushskey, - content, - coolpushqq: bool = True, - coolpushwx: bool = False, - coolpushemail: bool = False, -): +def message2coolpush(coolpushskey, content, coolpushqq: bool = True, coolpushwx: bool = False, coolpushemail: bool = False): print("Cool Push 推送开始") params = {"c": content, "t": "每日签到"} if coolpushqq: - requests.post(url=f"https://push.xuthus.cc/send/{coolpushskey}", params=params) + requests.post(url=f"https:#push.xuthus.cc/send/{coolpushskey}", params=params) if coolpushwx: - requests.post(url=f"https://push.xuthus.cc/wx/{coolpushskey}", params=params) + requests.post(url=f"https:#push.xuthus.cc/wx/{coolpushskey}", params=params) if coolpushemail: - requests.post(url=f"https://push.xuthus.cc/email/{coolpushskey}", params=params) + requests.post(url=f"https:#push.xuthus.cc/email/{coolpushskey}", params=params) return @@ -44,9 +65,9 @@ def message2qmsg(qmsg_key, qmsg_type, content): print("qmsg 酱推送开始") params = {"msg": content} if qmsg_type == "group": - requests.get(url=f"https://qmsg.zendee.cn/group/{qmsg_key}", params=params) + requests.get(url=f"https:#qmsg.zendee.cn/group/{qmsg_key}", params=params) else: - requests.get(url=f"https://qmsg.zendee.cn/send/{qmsg_key}", params=params) + requests.get(url=f"https:#qmsg.zendee.cn/send/{qmsg_key}", params=params) return @@ -58,9 +79,9 @@ def message2telegram(tg_api_host, tg_proxy, tg_bot_token, tg_user_id, content): "disable_web_page_preview": "true", } if tg_api_host: - url = f"https://{tg_api_host}/bot{tg_bot_token}/sendMessage" + url = f"https:#{tg_api_host}/bot{tg_bot_token}/sendMessage" else: - url = f"https://api.telegram.org/bot{tg_bot_token}/sendMessage" + url = f"https:#api.telegram.org/bot{tg_bot_token}/sendMessage" if tg_proxy: proxies = { "http": tg_proxy, @@ -75,9 +96,7 @@ def message2telegram(tg_api_host, tg_proxy, tg_bot_token, tg_user_id, content): def message2feishu(fskey, content): print("飞书 推送开始") data = {"msg_type": "text", "content": {"text": content}} - requests.post( - url=f"https://open.feishu.cn/open-apis/bot/v2/hook/{fskey}", json=data - ) + requests.post(url=f"https:#open.feishu.cn/open-apis/bot/v2/hook/{fskey}", json=data) return @@ -87,15 +106,11 @@ def message2dingtalk(dingtalk_secret, dingtalk_access_token, content): secret_enc = dingtalk_secret.encode("utf-8") string_to_sign = f"{timestamp}\n{dingtalk_secret}" string_to_sign_enc = string_to_sign.encode("utf-8") - hmac_code = hmac.new( - secret_enc, string_to_sign_enc, digestmod=hashlib.sha256 - ).digest() + hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest() sign = quote_plus(base64.b64encode(hmac_code)) send_data = {"msgtype": "text", "text": {"content": content}} requests.post( - url="https://oapi.dingtalk.com/robot/send?access_token={}×tamp={}&sign={}".format( - dingtalk_access_token, timestamp, sign - ), + url="https:#oapi.dingtalk.com/robot/send?access_token={}×tamp={}&sign={}".format(dingtalk_access_token, timestamp, sign), headers={"Content-Type": "application/json", "Charset": "UTF-8"}, data=json.dumps(send_data), ) @@ -116,28 +131,18 @@ def message2bark(bark_url: str, content): def message2qywxrobot(qywx_key, content): print("企业微信群机器人推送开始") requests.post( - url=f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={qywx_key}", + url=f"https:#qyapi.weixin.qq.com/cgi-bin/webhook/send?key={qywx_key}", data=json.dumps({"msgtype": "text", "text": {"content": content}}), ) return -def message2qywxapp( - qywx_corpid, - qywx_agentid, - qywx_corpsecret, - qywx_touser, - qywx_media_id, - qywx_origin, - content, -): +def message2qywxapp(qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, qywx_media_id, qywx_origin, content): print("企业微信应用消息推送开始") - base_url = "https://qyapi.weixin.qq.com" + base_url = "https:#qyapi.weixin.qq.com" if qywx_origin: base_url = qywx_origin - res = requests.get( - f"{base_url}/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}" - ) + res = requests.get(f"{base_url}/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}") token = res.json().get("access_token", False) if qywx_media_id: data = { @@ -150,7 +155,7 @@ def message2qywxapp( "title": "Dailycheckin 签到通知", "thumb_media_id": qywx_media_id, "author": "Sitoi", - "content_source_url": "https://github.com/Sitoi/dailycheckin", + "content_source_url": "https:#github.com/Sitoi/dailycheckin", "content": content.replace("\n", "
"), "digest": content, } @@ -165,7 +170,7 @@ def message2qywxapp( "textcard": { "title": "Dailycheckin 签到通知", "description": content, - "url": "https://github.com/Sitoi/dailycheckin", + "url": "https:#github.com/Sitoi/dailycheckin", "btntxt": "开源项目", }, } @@ -186,14 +191,12 @@ def message2pushplus(pushplus_token, content, pushplus_topic=None): } if pushplus_topic: data["topic"] = pushplus_topic - requests.post(url="http://www.pushplus.plus/send", data=json.dumps(data)) + requests.post(url="http:#www.pushplus.plus/send", data=json.dumps(data)) return def important_notice(): - datas = requests.get( - url="https://api.github.com/repos/Sitoi/dailycheckin/issues?state=open&labels=通知" - ).json() + datas = requests.get(url="https://api.github.com/repos/Sitoi/dailycheckin/issues?state=open&labels=通知").json() if datas: data = datas[0] title = data.get("title") @@ -206,6 +209,9 @@ def important_notice(): def push_message(content_list: list, notice_info: dict): + pushkey = notice_info.get("pushkey") + wxpusher_tk = notice_info.get("wxpusher_tk") + wxpusher_uid = notice_info.get("wxpusher_uid") dingtalk_secret = notice_info.get("dingtalk_secret") dingtalk_access_token = notice_info.get("dingtalk_access_token") fskey = notice_info.get("fskey") @@ -231,7 +237,7 @@ def push_message(content_list: list, notice_info: dict): qywx_origin = notice_info.get("qywx_origin") pushplus_token = notice_info.get("pushplus_token") pushplus_topic = notice_info.get("pushplus_topic") - merge_push = notice_info.get("merge_push") + merge_push = notice_info.get("merge_push").lower() == "true" # 转成bool content_str = "\n————————————\n\n".join(content_list) message_list = [content_str] try: @@ -242,27 +248,29 @@ def push_message(content_list: list, notice_info: dict): except Exception as e: print("获取重要通知失败:", e) if merge_push is None: - if ( - qmsg_key - or coolpushskey - or qywx_touser - or qywx_corpsecret - or qywx_agentid - or bark_url - or pushplus_token - ): + if qmsg_key or coolpushskey or qywx_touser or qywx_corpsecret or qywx_agentid or bark_url or pushplus_token: merge_push = False else: merge_push = True if not merge_push: message_list = content_list for message in message_list: - if qmsg_key: + if pushkey: + try: + message2pushdeer(pushkey=pushkey, content=message) + except Exception as e: + print("PushDeer 推送失败", e) + elif wxpusher_tk and wxpusher_uid: + try: + message2wxpuser(wxpuser_tk=wxpusher_tk, wxpusher_uid=wxpusher_uid, content=message) + except Exception as e: + print("wxpuser 推送失败", e) + elif qmsg_key: try: message2qmsg(qmsg_key=qmsg_key, qmsg_type=qmsg_type, content=message) except Exception as e: print("qmsg 推送失败", e) - if coolpushskey: + elif coolpushskey: try: message2coolpush( coolpushskey=coolpushskey, @@ -273,7 +281,7 @@ def push_message(content_list: list, notice_info: dict): ) except Exception as e: print("coolpush 推送失败", e) - if qywx_touser and qywx_corpid and qywx_corpsecret and qywx_agentid: + elif qywx_touser and qywx_corpid and qywx_corpsecret and qywx_agentid: try: message2qywxapp( qywx_corpid=qywx_corpid, @@ -286,12 +294,12 @@ def push_message(content_list: list, notice_info: dict): ) except Exception as e: print("企业微信应用消息推送失败", e) - if bark_url: + elif bark_url: try: message2bark(bark_url=bark_url, content=message) except Exception as e: print("Bark 推送失败", e) - if dingtalk_access_token and dingtalk_secret: + elif dingtalk_access_token and dingtalk_secret: try: message2dingtalk( dingtalk_secret=dingtalk_secret, @@ -300,27 +308,27 @@ def push_message(content_list: list, notice_info: dict): ) except Exception as e: print("钉钉推送失败", e) - if fskey: + elif fskey: try: message2feishu(fskey=fskey, content=message) except Exception as e: print("飞书推送失败", e) - if sckey: + elif sckey: try: message2server(sckey=sckey, content=message) except Exception as e: print("Server 推送失败", e) - if sendkey: + elif sendkey: try: message2server_turbo(sendkey=sendkey, content=message) except Exception as e: print("Server Turbo 推送失败", e) - if qywx_key: + elif qywx_key: try: message2qywxrobot(qywx_key=qywx_key, content=message) except Exception as e: print("企业微信群机器人推送失败", e) - if pushplus_token: + elif pushplus_token: try: message2pushplus( pushplus_token=pushplus_token, @@ -329,7 +337,7 @@ def push_message(content_list: list, notice_info: dict): ) except Exception as e: print("Pushplus 推送失败", e) - if tg_user_id and tg_bot_token: + elif tg_user_id and tg_bot_token: try: message2telegram( tg_api_host=tg_api_host, @@ -340,6 +348,8 @@ def push_message(content_list: list, notice_info: dict): ) except Exception as e: print("Telegram 推送失败", e) + else: + print("未配置任何推送渠道❌") if __name__ == "__main__": From 4fa4cb32685bce03a9a46d967d4d774a40f3b35e Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 09:52:04 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=E2=9A=A0=EF=B8=8F3.12=E4=B8=AD=20datetime.utcnow()=20->=20date?= =?UTF-8?q?time.now()=20=E2=9A=A0=EF=B8=8F=E4=B8=8D=E7=A1=AE=E5=AE=9A?= =?UTF-8?q?=E4=BB=A5=E5=89=8D=E7=89=88=E6=9C=AC=E6=98=AF=E5=90=A6=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/main.py | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/dailycheckin/main.py b/dailycheckin/main.py index 7de5773..f461ac4 100755 --- a/dailycheckin/main.py +++ b/dailycheckin/main.py @@ -49,12 +49,8 @@ def check_config(task_list): for one_check, _ in checkin_map.items(): if one_check in task_list: if _check_info.get(one_check.lower()): - for _, check_item in enumerate( - _check_info.get(one_check.lower(), []) - ): - if "xxxxxx" not in str(check_item) and "多账号" not in str( - check_item - ): + for _, check_item in enumerate(_check_info.get(one_check.lower(), [])): + if "xxxxxx" not in str(check_item) and "多账号" not in str(check_item): if one_check.lower() not in check_info.keys(): check_info[one_check.lower()] = [] check_info[one_check.lower()].append(check_item) @@ -63,16 +59,13 @@ def check_config(task_list): print(e) return False, False else: - print( - "未找到 config.json 配置文件\n请在下方任意目录中添加「config.json」文件:\n" - + "\n".join(config_path_list) - ) + print("未找到 config.json 配置文件\n请在下方任意目录中添加「config.json」文件:\n" + "\n".join(config_path_list)) return False, False def checkin(): start_time = time.time() - utc_time = (datetime.utcnow() + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S") + utc_time = (datetime.now() + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S") # update: Deprecated since version 3.12: Use datetime.now() with UTC instead. print(f"当前时间: {utc_time}\n当前版本: {__version__}") args = parse_arguments() include = args.include @@ -88,12 +81,7 @@ def checkin(): task_list = list(set(include) - set(exclude)) notice_info, check_info = check_config(task_list) if check_info: - task_name_str = "\n".join( - [ - f"「{checkin_map.get(one.upper())[0]}」账号数 : {len(value)}" - for one, value in check_info.items() - ] - ) + task_name_str = "\n".join([f"「{checkin_map.get(one.upper())[0]}」账号数 : {len(value)}" for one, value in check_info.items()]) print(f"\n---------- 本次执行签到任务如下 ----------\n\n{task_name_str}\n\n") content_list = [] for one_check, check_list in check_info.items(): @@ -111,18 +99,13 @@ def checkin(): try: url = "https://pypi.org/pypi/dailycheckin/json" latest_version = requests.get(url=url, timeout=30).json()["info"]["version"] - except: + except: # noqa: E722 print("获取最新版本失败") latest_version = "0.0.0" - content_list.append( - f"开始时间: {utc_time}\n" - f"任务用时: {int(time.time() - start_time)} 秒\n" - f"当前版本: {__version__}\n" - f"最新版本: {latest_version}\n" - f"项目地址: https://github.com/Sitoi/dailycheckin" - ) + content_list.append(f"开始时间: {utc_time}\n" f"任务用时: {int(time.time() - start_time)} 秒\n" f"当前版本: {__version__}\n" f"最新版本: {latest_version}\n" f"项目地址: https://github.com/Sitoi/dailycheckin") push_message(content_list=content_list, notice_info=notice_info) return + # push_message(content_list=content_list, notice_info=notice_info) if __name__ == "__main__": From 8d2ef513661ae6c78ee52366536fdde5c05cb7d4 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 09:55:21 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=9A=84checkin=E4=BB=BB=E5=8A=A1=EF=BC=9A?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=BB=A5=E4=B8=8B=E6=96=B9=E6=B3=95=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=20`python=20main.py=20--include=20TESTNOTICE`=20?= =?UTF-8?q?=E2=9A=A0=EF=B8=8F=E6=B3=A8=E6=84=8F=EF=BC=9A=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=9C=A8config.json=E6=96=87=E4=BB=B6=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=A6=82=E4=B8=8B=E5=AD=97=E6=AE=B5=20```=20"YOUDAO":?= =?UTF-8?q?=20[=20=20=20=20=20=20=20=20=20{=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20"cookie":=20"JSESSIONID=3Dxxxxxx;=20=5F=5Fyadk=5Fuid?= =?UTF-8?q?=3Dxxxxxx;=20OUTFOX=5FSEARCH=5FUSER=5FID=5FNCOO=3Dxxxxxx;=20YNO?= =?UTF-8?q?TE=5FSESS=3Dxxxxxx;=20YNOTE=5FPERS=3Dxxxxxx;=20YNOTE=5FLOGIN=3D?= =?UTF-8?q?xxxxxx;=20YNOTE=5FCSTK=3Dxxxxxx;=20=5Fga=3Dxxxxxx;=20=5Fgid=3Dx?= =?UTF-8?q?xxxxx;=20=5Fgat=3Dxxxxxx;=20PUBLIC=5FSHARE=5F18a9dde3de846b6a69?= =?UTF-8?q?e24431764270c4=3Dxxxxxx;"=20=20=20=20=20=20=20=20=20},=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20{=20=20=20=20=20=20=20=20=20=20=20=20=20"cook?= =?UTF-8?q?ie":=20"=E5=A4=9A=E8=B4=A6=E5=8F=B7=20cookie=20=E5=A1=AB?= =?UTF-8?q?=E5=86=99=EF=BC=8C=E8=AF=B7=E5=8F=82=E8=80=83=E4=B8=8A=E9=9D=A2?= =?UTF-8?q?=EF=BC=8Ccookie=20=E4=BB=A5=E5=AE=9E=E9=99=85=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=BA=E5=87=86=EF=BC=88=E9=81=87=E5=88=B0=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E5=A6=82=E5=8F=8C=E5=BC=95=E5=8F=B7\"=20?= =?UTF-8?q?=E8=AF=B7=E5=8A=A0=E5=8F=8D=E6=96=9C=E6=9D=A0=E8=BD=AC=E4=B9=89?= =?UTF-8?q?=EF=BC=89"=20=20=20=20=20=20=20=20=20}=20=20=20=20=20]=20=20=20?= =?UTF-8?q?=20=20//=E4=BB=A5=E4=B8=8B=E6=98=AF=E6=96=B0=E5=A2=9E=E5=86=85?= =?UTF-8?q?=E5=AE=B9=20=20=20=20=20,=20=20=20=20=20"TESTNOTICE":=20[=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20{=20=20=20=20=20=20=20=20=20=20=20=20=20"t?= =?UTF-8?q?est1":=20"test1"=20=20=20=20=20=20=20=20=20}=20=20=20=20=20]=20?= =?UTF-8?q?```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/test/__init__.py | 0 dailycheckin/test/main.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 dailycheckin/test/__init__.py create mode 100644 dailycheckin/test/main.py diff --git a/dailycheckin/test/__init__.py b/dailycheckin/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dailycheckin/test/main.py b/dailycheckin/test/main.py new file mode 100644 index 0000000..ec4dc69 --- /dev/null +++ b/dailycheckin/test/main.py @@ -0,0 +1,23 @@ +from dailycheckin import CheckIn +import os +import json + + +class TestNotice(CheckIn): + name = "通知测试" + + def __init__(self, check_item): + self.check_item = check_item + + def main(self): + return f"测试内容{self.check_item}" + + +if __name__ == "__main__": + with open( + os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.json"), + encoding="utf-8", + ) as f: + datas = json.loads(f.read()) + _check_item = datas.get("TestNotice", [])[0] + print(TestNotice(check_item=_check_item).main()) From acb0dabacf54d02b4b701d2e5be09d0373470444 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 10:03:27 +0000 Subject: [PATCH 6/8] =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E9=83=A8=E7=BD=B2=EF=BC=8C=E5=8F=AA=E5=9C=A8readme?= =?UTF-8?q?=E4=B8=AD=E7=AE=80=E8=A6=81=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index b4f7ddc..30ebf27 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,23 @@ ## 💬 通知列表 +- [PushDeer](https://www.pushdeer.com/) +- [wxPusher](https://wxpusher.zjiecode.com/docs/#/) + +> 新增以上渠道配置如下 +> +```json +{ + "PUSHKEY": "", //PushDeer 的 pushkey + "WXPUSHER_TK": "", //wxpusher_token + "WXPUSHER_UID": "", //wxpusher_uid + //以上是新增内容 + "BARK_URL": "", + ... +} +``` + + - dingtalk(钉钉) - 企业微信群机器人(企业微信) - 企业微信应用消息(企业微信) From 6514decda7064338172e93efc4a56e34b7f7ec27 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Mon, 13 May 2024 10:24:25 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30ebf27..5abe714 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,12 @@ - [PushDeer](https://www.pushdeer.com/) - [wxPusher](https://wxpusher.zjiecode.com/docs/#/) +> [PushDeer预览](https://pic2.ziyuan.wang/user/fansir/2024/05/1715593565981_39b4eff978354.png) +> +> [wxPusher预览](https://pic2.ziyuan.wang/user/fansir/2024/05/1715593114657_e53ec9acf7e1e.png) +> > 新增以上渠道配置如下 -> + ```json { "PUSHKEY": "", //PushDeer 的 pushkey From c5547ea63420b511bdb32341ab815cf7fe3a8634 Mon Sep 17 00:00:00 2001 From: Byseven <38542005+Fansirsqi@users.noreply.github.com> Date: Wed, 15 May 2024 09:07:51 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=93=9A=E6=B7=BB=E5=8A=A0=E4=B9=9F?= =?UTF-8?q?=E8=AE=B8=E4=B8=8D=E6=98=AF=E5=BE=88=E8=A7=84=E8=8C=83=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E6=96=87=E6=A1=A3=E9=83=A8=E7=BD=B2=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 5abe714..d46b6a5 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,38 @@ + +## 如何使用本仓库内容 + +在青龙创建一个订阅 + +拉库命令 `ql repo https://github.com/Fansirsqi/dailycheckin.git null null null main` + +配置执行后运行的命令 +`pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip install requests pycrypto pycryptodome && cd /ql/data/repo/Fansirsqi_dailycheckin_main && python setup.py develop` + +在脚本管理根目录创建`config.json`配置文件可以参考官方配置,这里只是增加了一段 + +[配置示例](https://gist.githubusercontent.com/Fansirsqi/9e238bb3e432fdb7bee1caa46da81519/raw/5a7d599b526564c68b0120e9a275ce6f414757df/config.json) + +``` +, + "TESTNOTICE": [ + { + "test1": "test1mesg" + } + ] +``` +强烈建议您在`https://www.json.cn/`这个网站检查您的配置 + +最后在定时任务里创建一个测试任务 + +`task dailycheckin --include TESTNOTICE`运行并查看日志 + +![1715763862230.png](https://pic2.ziyuan.wang/user/fansir/2024/05/1715763862230_5344cb6724871.png) + +![1715763931708.png](https://pic2.ziyuan.wang/user/fansir/2024/05/1715763931708_ec7c766df87c4.png) + ## ✨ 特性 - 📦 支持 Pypi 包安装