INNER CODE UNIT · Python
get_latest_version_from_updated_cache_file
stanfrbd/cyberbro · app.py:170
def get_latest_version_from_updated_cache_file(cache_file: Path) -> str:
"""Update the cache file with the latest version and current time."""
url: str = "https://api.github.com/repos/stanfrbd/cyberbro/releases/latest"
if not cache_file.exists():
cache_file.touch()
try:
response = requests.get(url, proxies=PROXIES, verify=SSL_VERIFY, timeout=5)
response.raise_for_status()
latest_release: dict = response.json()
latest_version = latest_release.get("tag_name", "")
except requests.exceptions.RequestException as e:
logger.error(f"Error fetching latest version: {e}")
return ""
except json.JSONDecodeError as e:
logger.error(f"Error decoding JSON response: {e}")