当前位置: 首页>>代码示例>>Python>>正文


Python CUCKOO_VERSION.endswith方法代码示例

本文整理汇总了Python中lib.cuckoo.common.constants.CUCKOO_VERSION.endswith方法的典型用法代码示例。如果您正苦于以下问题:Python CUCKOO_VERSION.endswith方法的具体用法?Python CUCKOO_VERSION.endswith怎么用?Python CUCKOO_VERSION.endswith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.cuckoo.common.constants.CUCKOO_VERSION的用法示例。


在下文中一共展示了CUCKOO_VERSION.endswith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_version

# 需要导入模块: from lib.cuckoo.common.constants import CUCKOO_VERSION [as 别名]
# 或者: from lib.cuckoo.common.constants.CUCKOO_VERSION import endswith [as 别名]
def check_version():
    """Checks version of Cuckoo."""
    cfg = Config()

    if not cfg.cuckoo.version_check:
        return

    print(" Checking for updates...")

    url = "http://api.cuckoosandbox.org/checkversion.php"
    data = urllib.urlencode({"version": CUCKOO_VERSION})

    try:
        request = urllib2.Request(url, data)
        response = urllib2.urlopen(request)
    except (urllib2.URLError, urllib2.HTTPError):
        print(red(" Failed! ") + "Unable to establish connection.\n")
        return

    try:
        response_data = json.loads(response.read())
    except ValueError:
        print(red(" Failed! ") + "Invalid response.\n")
        return

    stable_version = response_data["current"]

    if CUCKOO_VERSION.endswith("-dev"):
        print(yellow(" You are running a development version! Current stable is {}.".format(
            stable_version)))
    else:
        if LooseVersion(CUCKOO_VERSION) < LooseVersion(stable_version):
            msg = "Cuckoo Sandbox version {} is available now.".format(
                stable_version)

            print(red(" Outdated! ") + msg)
        else:
            print(green(" Good! ") + "You have the latest version "
                                     "available.\n")
开发者ID:awest1339,项目名称:cuckoo,代码行数:41,代码来源:startup.py


注:本文中的lib.cuckoo.common.constants.CUCKOO_VERSION.endswith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。