INNER CODE UNIT · Python
check_for_updates
gorilla-llm/gorilla-cli · go_cli.py:103
def check_for_updates():
# Check if a new version of gorilla-cli is available once a day
try:
with open(UPDATE_CHECK_FILE, "r") as f:
last_check_date = datetime.datetime.strptime(f.read(), "%Y-%m-%d")
except FileNotFoundError:
last_check_date = datetime.datetime.now() - datetime.timedelta(days=1)
if datetime.datetime.now() - last_check_date >= datetime.timedelta(days=1):
try:
response = requests.get("https://pypi.org/pypi/gorilla-cli/json")
latest_version = response.json()["info"]["version"]
if latest_version > __version__:
print(f"A new version is available: {latest_version}. Update with `pip install --upgrade gorilla-cli`")
except Exception as e:
print("Unable to check for updates:", e)
try:
with open(UPDATE_CHECK_FILE, "w") as f: