def need_update(self):
if "HTTP_PROXY" in os.environ or "HTTPS_PROXY" in os.environ:
if "HTTP_PROXY" in os.environ:
if sys.version_info >= (3, 0):
proxy = urllib.parse.urlparse(os.environ["HTTP_PROXY"])
else:
proxy = urlparse.urlparse(os.environ["HTTP_PROXY"])
else:
if sys.version_info >= (3, 0):
proxy = urllib.parse.urlparse(os.environ["HTTPS_PROXY"])
else:
proxy = urlparse.urlparse(os.environ["HTTPS_PROXY"])
if sys.version_info >= (3, 0):
conn = http.client.HTTPSConnection(proxy.hostname, proxy.port)
else:
conn = httplib.HTTPSConnection(proxy.hostname, proxy.port)
conn.set_tunnel(self.version_host, 443)
else:
if sys.version_info >= (3, 0):
conn = http.client.HTTPSConnection("raw.githubusercontent.com")
else:
conn = httplib.HTTPSConnection("raw.githubusercontent.com")
conn.request("GET", self.version_url)
version = conn.getresponse().read()
try:
if StrictVersion(version) > StrictVersion(PYJFUZZ_VERSION):
self.new_version = version
return True
except:
pass
return False
评论列表
文章目录