本文整理汇总了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)
示例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)