summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2023-12-24 20:54:10 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2023-12-24 20:54:10 +0100
commit5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff (patch)
treeba005b511ed8e684960039b5a48cccfb9bacd04c
parentFix port mapping in docker run (diff)
downloadgpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar.gz
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar.bz2
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar.lz
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar.xz
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.tar.zst
gpt4free-5a7ce3a8abbaaea7e739d8802d73b6f23b57ecff.zip
Diffstat (limited to '')
-rw-r--r--g4f/debug.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/g4f/debug.py b/g4f/debug.py
index 67664e5b..9d2f40ed 100644
--- a/g4f/debug.py
+++ b/g4f/debug.py
@@ -1,5 +1,5 @@
from os import environ
-from requests import get
+import requests
from importlib.metadata import version as get_package_version, PackageNotFoundError
from subprocess import check_output, CalledProcessError, PIPE
from .errors import VersionNotFoundError
@@ -26,7 +26,13 @@ def get_version() -> str:
raise VersionNotFoundError("Version not found")
def get_latest_version() -> str:
- response = get("https://pypi.org/pypi/g4f/json").json()
+ if environ.get("G4F_VERSION"):
+ url = "https://registry.hub.docker.com/v2/repositories/"
+ url += "hlohaus789/g4f"
+ url += "/tags?page_size=2&ordering=last_updated"
+ response = requests.get(url).json()
+ return response["results"][1]["name"]
+ response = requests.get("https://pypi.org/pypi/g4f/json").json()
return response["info"]["version"]
def check_pypi_version() -> None: