紧急bug修复
This commit is contained in:
parent
99651b2ff7
commit
dc274eff5d
@ -33,8 +33,10 @@ def fetch_rss(url, timeout=10):
|
|||||||
return response.json()
|
return response.json()
|
||||||
except requests.Timeout:
|
except requests.Timeout:
|
||||||
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
||||||
|
return None
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.error(f"请求 {url} 时发生错误: {e}")
|
logger.error(f"请求 {url} 时发生错误: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
def save_to_json(data, filename):
|
def save_to_json(data, filename):
|
||||||
with open(filename, 'w', encoding='utf-8') as f:
|
with open(filename, 'w', encoding='utf-8') as f:
|
||||||
@ -46,6 +48,9 @@ def github_main_keyword(key):
|
|||||||
logger.info(f"github_keyword:关键词【{keyword}】获取开始。")
|
logger.info(f"github_keyword:关键词【{keyword}】获取开始。")
|
||||||
api_node = "https://api.github.com/search/repositories?q={}&sort=updated&per_page=20".format(keyword)
|
api_node = "https://api.github.com/search/repositories?q={}&sort=updated&per_page=20".format(keyword)
|
||||||
result = fetch_rss(api_node)
|
result = fetch_rss(api_node)
|
||||||
|
if result == None:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
for i in range(0, 20):
|
for i in range(0, 20):
|
||||||
description = result['items'][i]['description']
|
description = result['items'][i]['description']
|
||||||
|
|
||||||
@ -94,6 +99,9 @@ def github_main_repo(key):
|
|||||||
logger.info(f"github_repo:项目【{keyword}】更新情况获取开始。")
|
logger.info(f"github_repo:项目【{keyword}】更新情况获取开始。")
|
||||||
api_node = "https://api.github.com/repos/{}/commits?per_page=1".format(keyword)
|
api_node = "https://api.github.com/repos/{}/commits?per_page=1".format(keyword)
|
||||||
result = fetch_rss(api_node)
|
result = fetch_rss(api_node)
|
||||||
|
if result == None:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
|
|
||||||
commit = result[0] # 获取最新的提交记录
|
commit = result[0] # 获取最新的提交记录
|
||||||
description = commit['commit']['message']
|
description = commit['commit']['message']
|
||||||
@ -136,6 +144,9 @@ def github_main_release(key):
|
|||||||
logger.info(f"github_repo:项目【{keyword}】发版情况获取开始。")
|
logger.info(f"github_repo:项目【{keyword}】发版情况获取开始。")
|
||||||
api_node = "https://api.github.com/repos/{}/releases?per_page=1".format(keyword)
|
api_node = "https://api.github.com/repos/{}/releases?per_page=1".format(keyword)
|
||||||
result = fetch_rss(api_node)
|
result = fetch_rss(api_node)
|
||||||
|
if result == None:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
if not result:
|
if not result:
|
||||||
logger.warning(f"github_repo:项目【{keyword}】不存在版本发布情况。")
|
logger.warning(f"github_repo:项目【{keyword}】不存在版本发布情况。")
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
@ -168,6 +179,9 @@ def github_main_user(key):
|
|||||||
logger.info(f"github_user:作者【{keyword}】更新情况获取开始。")
|
logger.info(f"github_user:作者【{keyword}】更新情况获取开始。")
|
||||||
api_node = "https://api.github.com/users/{}/repos?sort=created&per_page=10".format(keyword)
|
api_node = "https://api.github.com/users/{}/repos?sort=created&per_page=10".format(keyword)
|
||||||
result = fetch_rss(api_node)
|
result = fetch_rss(api_node)
|
||||||
|
if result == None:
|
||||||
|
time.sleep(5)
|
||||||
|
continue
|
||||||
for i in range(0, len(result)):
|
for i in range(0, len(result)):
|
||||||
description = result[i]['description']
|
description = result[i]['description']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user