XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Update get_latest_version for docker

5a7ce3a8
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +8 -2
Modified g4f/debug.py +8 -2
@@ -1,5 +1,5 @@
1 1 from os import environ
2 from requests import get
2 import requests
3 3 from importlib.metadata import version as get_package_version, PackageNotFoundError
4 4 from subprocess import check_output, CalledProcessError, PIPE
5 5 from .errors import VersionNotFoundError
@@ -26,7 +26,13 @@ def get_version() -> str:
26 26 raise VersionNotFoundError("Version not found")
27 27
28 28 def get_latest_version() -> str:
29 response = get("https://pypi.org/pypi/g4f/json").json()
29 if environ.get("G4F_VERSION"):
30 url = "https://registry.hub.docker.com/v2/repositories/"
31 url += "hlohaus789/g4f"
32 url += "/tags?page_size=2&ordering=last_updated"
33 response = requests.get(url).json()
34 return response["results"][1]["name"]
35 response = requests.get("https://pypi.org/pypi/g4f/json").json()
30 36 return response["info"]["version"]
31 37
32 38 def check_pypi_version() -> None: