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


Python CONFIG.get方法代码示例

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


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

示例1: open_or_die

# 需要导入模块: from neubot.config import CONFIG [as 别名]
# 或者: from neubot.config.CONFIG import get [as 别名]
    def open_or_die(self):

        ''' Open the database or die '''

        if not GEOIP:
            logging.error("Missing dependency: GeoIP")
            logging.info("Please install GeoIP python wrappers, e.g.")
            logging.info("    sudo apt-get install python-geoip")
            sys.exit(1)

        path = CONFIG.get("rendezvous.geoip_wrapper.country_database",
                          COUNTRY_DATABASE)

        #
        # Detect the common error case, i.e. that the user has
        # not downloaded the database.  If something fancy is
        # going on, let the GeoIP library stacktrace for us.
        #
        if not os.path.exists(path):
            logging.error("Missing GeoLiteCountry database: %s", path)
            logging.info("Please download it from "
                     "<http://www.maxmind.com/app/geolitecountry>.")
            sys.exit(1)

        self.countries = GEOIP.open(path, GEOIP.GEOIP_STANDARD)
开发者ID:EverlastingFire,项目名称:neubot,代码行数:27,代码来源:geoip_wrapper.py

示例2: open_or_die

# 需要导入模块: from neubot.config import CONFIG [as 别名]
# 或者: from neubot.config.CONFIG import get [as 别名]
    def open_or_die(self):
        path = CONFIG.get("rendezvous.geoip_wrapper.country_database",
                          COUNTRY_DATABASE)

        #
        # Detect the common error case, i.e. that the user has
        # not downloaded the database.  If something fancy is
        # going on, let the GeoIP library stacktrace for us.
        #
        if not os.path.exists(path):
            LOG.error("Missing GeoLiteCountry database: %s" % path)
            LOG.info("Please download it from "
                     "<http://www.maxmind.com/app/geolitecountry>.")
            sys.exit(1)

        self.countries = GeoIP.open(path, GeoIP.GEOIP_STANDARD)
开发者ID:ClaudioArtusio,项目名称:neubot,代码行数:18,代码来源:geoip_wrapper.py


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