ℹ️ HackerTray is a minimalist Hacker News app for Linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
859 B

import requests
import pkg_resources
class Version:
PYPI_URL = "https://pypi.python.org/pypi/hackertray/json"
def latest():
res = requests.get(Version.PYPI_URL).json()
return res['info']['version']
def current():
return pkg_resources.require("hackertray")[0].version
def new_available():
latest = Version.latest()
current = Version.current()
if pkg_resources.parse_version(latest) > pkg_resources.parse_version(current):
print("[+] New version " + latest + " is available")
return True
return False
except requests.exceptions.RequestException as e:
print("[+] There was an error in trying to fetch updates")
return False