MCPcopy
hub / github.com/linbailo/zyqinglong / get_version_from_github

Function get_version_from_github

得物森林.py:87–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86
87def get_version_from_github():
88 latest_version = '获取失败'
89 username = "q7q7q7q7q7q7q7"
90 repo = "ziyou"
91 filepath = "得物森林.py"
92 url_list = [
93 f'https://raw.fgit.cf/{username}/{repo}/main/{filepath}',
94 f"https://ghproxy.com/https://raw.githubusercontent.com/{username}/{repo}/main/{filepath}",
95 ]
96 for url in url_list:
97 try:
98 response = requests.get(url, timeout=(10, 10))
99 if response.status_code == 200:
100 response_text = response.text
101 version_regex = r"^__version__\s*=\s*[\'\"]([^\'\"]*)[\'\"]"
102 version_match = re.search(version_regex, response_text,
103 re.MULTILINE)
104 if version_match is not None and __version__:
105 latest_version = version_match.group(1)
106 break
107 except Exception as e:
108 if e:
109 pass
110 myprint(f'现在运行的版本是:{__version__},最新版本:{latest_version}',
111 flush=True)
112
113
114# 下载作者的助力码

Callers 1

mainFunction · 0.85

Calls 2

myprintFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected