Skip to content

Commit

Permalink
🐛 修复钉钉推送
Browse files Browse the repository at this point in the history
  • Loading branch information
Oreomeow committed Oct 15, 2022
1 parent 44b456f commit 780a0cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions notify_mtr.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ def dingding_bot(title: str, content: str) -> None:
f'access_token={push_config.get("DD_BOT_TOKEN")}&timestamp={timestamp}&sign={sign}'
)
headers = {"Content-Type": "application/json;charset=utf-8"}
data = {
json = {
"msgtype": "markdown",
"markdown": {"text": html2md(content), "title": title},
}

response = requests.post(url, json=json.dumps(data), headers=headers, timeout=15)
response = requests.post(url, json=json, headers=headers, timeout=15)
json_data = response.json()
if json_data.get("errcode") == 0:
print("钉钉机器人 推送成功!")
Expand Down
6 changes: 2 additions & 4 deletions notify_mtr_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,10 @@ def dingding_bot(title: str, content: str) -> None:
f'access_token={push_config.get("DD_BOT_TOKEN")}&timestamp={timestamp}&sign={sign}'
)
headers = {"Content-Type": "application/json;charset=utf-8"}
data = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}}
json = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}}

try:
response = requests.post(
url=url, data=json.dumps(data), headers=headers, timeout=15
)
response = requests.post(url=url, json=json, headers=headers, timeout=15)
try:
json_data = response.json()
if json_data.get("errcode") == 0:
Expand Down
2 changes: 1 addition & 1 deletion utils_ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import requests

__version__ = "20221015-4-131"
__version__ = "20221015-4-141"
ver_re = re.compile("__version__ = .(\\d+-\\d+-...).")


Expand Down

0 comments on commit 780a0cd

Please sign in to comment.