[fix] 修复推送没有url的错误

This commit is contained in:
yhy0 2021-07-29 18:08:54 +08:00
parent 0a0ce978fd
commit 5b88a83b2b

View File

@ -57,7 +57,8 @@ def get_update_log(url):
else: else:
json_str = requests.get(url + '/commits', headers = github_headers, timeout= 10).json() json_str = requests.get(url + '/commits', headers = github_headers, timeout= 10).json()
update_log = json_str[0]['commit']['message'] update_log = json_str[0]['commit']['message']
return update_log, '' download_url = json_str[0]['html_url']
return update_log, download_url
# 创建md5对象 # 创建md5对象
@ -200,11 +201,7 @@ def sendNews(tools_list):
update_log, download_url = get_update_log(tools_list[i]) update_log, download_url = get_update_log(tools_list[i])
tools_name = tools_list[i].split('/')[-1] tools_name = tools_list[i].split('/')[-1]
text = r'** ' + tools_name + r' ** 工具更新啦!' text = r'** ' + tools_name + r' ** 工具更新啦!'
# body = '' body = "工具名称:" + tools_name + "\r\n" + "工具地址:" + download_url + "\r\n" + "工具更新日志:" + update_log
if download_url != '':
body = "工具名称:" + tools_name + "\r\n" + "工具下载地址:" + download_url + "\r\n" + "工具更新日志:" + update_log
else:
body = "工具名称:" + "\r\n" + "工具更新日志:" + update_log
# 三选一即可,没配置的 注释或者删掉 # 三选一即可,没配置的 注释或者删掉
# server(text, body) # server(text, body)
dingding(text, body) dingding(text, body)