From 7fcc3406bcaf15eb7554f6b5244fdbc2841718cc Mon Sep 17 00:00:00 2001 From: shitao <133397418@qq.com> Date: Fri, 8 Mar 2024 10:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E9=87=8D=E6=9E=84(message?= =?UTF-8?q?.py)=EF=BC=9A=E6=94=B9=E8=BF=9B=E5=8F=98=E9=87=8F=E5=91=BD?= =?UTF-8?q?=E5=90=8D=EF=BC=8C=E4=BB=8EbastUrl=E6=94=B9=E4=B8=BAbast=5Furl?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E7=AC=A6=E5=90=88Python=E7=9A=84PEP8?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/utils/message.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dailycheckin/utils/message.py b/dailycheckin/utils/message.py index 0df8e4c..6f2d0a8 100755 --- a/dailycheckin/utils/message.py +++ b/dailycheckin/utils/message.py @@ -123,14 +123,20 @@ def message2qywxrobot(qywx_key, content): def message2qywxapp( - qywx_corpid, qywx_agentid, qywx_corpsecret, qywx_touser, qywx_media_id, qywx_origin, content + qywx_corpid, + qywx_agentid, + qywx_corpsecret, + qywx_touser, + qywx_media_id, + qywx_origin, + content, ): print("企业微信应用消息推送开始") - bastUrl = "https://qyapi.weixin.qq.com" + bast_url = "https://qyapi.weixin.qq.com" if qywx_origin: - bastUrl = qywx_origin; + bast_url = qywx_origin res = requests.get( - f"{bastUrl}/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}" + f"{bast_url}/cgi-bin/gettoken?corpid={qywx_corpid}&corpsecret={qywx_corpsecret}" ) token = res.json().get("access_token", False) if qywx_media_id: @@ -164,7 +170,7 @@ def message2qywxapp( }, } requests.post( - url=f"{bastUrl}/cgi-bin/message/send?access_token={token}", + url=f"{bast_url}/cgi-bin/message/send?access_token={token}", data=json.dumps(data), ) return