web.py 文件源码

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

项目:nameko-slack 作者: iky 项目源码 文件源码
def setup(self):

        try:
            config = self.container.config[constants.CONFIG_KEY]
        except KeyError:
            raise ConfigurationError(
                '`{}` config key not found'.format(constants.CONFIG_KEY))

        if self.bot_name:
            try:
                token = config['BOTS'][self.bot_name]
            except KeyError:
                raise ConfigurationError(
                    'No token for `{}` bot in `{}` config'
                    .format(self.bot_name, constants.CONFIG_KEY))
        else:
            token = (
                config.get('BOTS', {}).get(constants.DEFAULT_BOT_NAME) or
                config.get('TOKEN'))
        if not token:
            raise ConfigurationError(
                'No token provided by `{}` config'
                .format(constants.CONFIG_KEY))

        self.client = SlackClient(token)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号