update.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:hakkuframework 作者: 4shadoww 项目源码 文件源码
def check_for_updates():
    try:
        print(colors.green+"checking for updates..."+colors.end)
        r = requests.get("https://api.github.com/repos/4shadoww/hakkuframework/releases/latest")
        if(r.ok):
            items = json.loads(r.text or r.content)
            rver = items['tag_name']

            if "beta" in rver and "alpha" in info.version:
                print(colors.green+"update found"+colors.end)
                return True 

            elif "beta" not in rver and "alpha" not in rver:
                if "beta" in info.version or "alpha" in info.version:
                    print(colors.green+"update found"+colors.end)
                    return True

            elif version.parse(rver) > version.parse(info.version):
                print(colors.green+"update found"+colors.end)
                return True

            else:
                print(colors.yellow+"updates not found"+colors.end)
                return False
        else:
            print("error")
    except Exception as error:
        print(colors.red+"error: "+str(error)+colors.end)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号