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


Python config.Config方法代码示例

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


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

示例1: interact

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def interact(config, args):
    ns = netsuite.NetSuite(config)

    user_ns = {"ns": ns}

    banner1 = """Welcome to Netsuite WS client interactive mode
Available vars:
    `ns` - NetSuite client

Example usage:
    ws_results = ns.getList('customer', internalIds=[1337])
    restlet_results = ns.restlet.request(987)
    rest_api_results = await ns.rest_api.get("/record/v1/salesOrder")
"""

    IPython.embed(
        user_ns=user_ns,
        banner1=banner1,
        config=traitlets.config.Config(colors="LightBG"),
        # To fix no colored input we pass in `using=False`
        # See: https://github.com/ipython/ipython/issues/11523
        # TODO: Remove once this is fixed upstream
        using=False,
    ) 
开发者ID:jmagnusson,项目名称:netsuite,代码行数:26,代码来源:__main__.py

示例2: _load_config_or_error

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def _load_config_or_error(path: str, section: str) -> config.Config:
    try:
        return config.from_ini(path=path, section=section)
    except FileNotFoundError:
        parser.error(f"Config file {path} not found")
    except KeyError as ex:
        if ex.args == (section,):
            parser.error(f"No config section `{section}` in file {path}")
        else:
            raise ex 
开发者ID:jmagnusson,项目名称:netsuite,代码行数:12,代码来源:__main__.py

示例3: _get_rest_api_or_error

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def _get_rest_api_or_error(config: config.Config):
    ns = netsuite.NetSuite(config)

    try:
        return ns.rest_api  # Cached property that initializes NetSuiteRestApi
    except RuntimeError as ex:
        parser.error(str(ex)) 
开发者ID:jmagnusson,项目名称:netsuite,代码行数:9,代码来源:__main__.py

示例4: cli

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def cli(info, config_path):
    """a token based matrix registration app"""
    config.config = config.Config(config_path)
    logging.config.dictConfig(config.config.logging)
    app = info.load_app()
    with app.app_context():
        app.config.from_mapping(
            SQLALCHEMY_DATABASE_URI=config.config.db.format(cwd=f"{os.getcwd()}/"),
            SQLALCHEMY_TRACK_MODIFICATIONS=False
        )
        db.init_app(app)
        db.create_all()
        tokens.tokens = tokens.Tokens() 
开发者ID:ZerataX,项目名称:matrix-registration,代码行数:15,代码来源:app.py

示例5: dashboard

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def dashboard():
    """Primary dashboard the users will interact with."""
    logger.info(
        "User: {} authenticated proceeding to dashboard.".format(
            session.get("id_token")["sub"]
        )
    )

    if "Mozilla-LDAP" in session.get("userinfo")["sub"]:
        logger.info("Mozilla IAM user detected. Attempt enriching with ID-Vault data.")
        try:
            session["idvault_userinfo"] = person_api.get_userinfo(
                session.get("id_token")["sub"]
            )
        except Exception as e:
            logger.error(
                "Could not enrich profile due to: {}.  Perhaps it doesn't exist?".format(
                    e
                )
            )

    # Hotfix to set user id for firefox alert
    # XXXTBD Refactor rules later to support full id_conformant session
    session["userinfo"]["user_id"] = session.get("id_token")["sub"]

    # Transfer any updates in to the app_tiles.
    S3Transfer(config.Config(app).settings).sync_config()

    # Send the user session and browser headers to the alert rules engine.
    Rules(userinfo=session["userinfo"], request=request).run()

    user = User(session, config.Config(app).settings)
    apps = user.apps(Application(app_list.apps_yml).apps)

    return render_template(
        "dashboard.html", config=app.config, user=user, apps=apps, alerts=None
    ) 
开发者ID:mozilla-iam,项目名称:sso-dashboard,代码行数:39,代码来源:app.py

示例6: styleguide_dashboard

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def styleguide_dashboard():
    user = FakeUser(config.Config(app).settings)
    apps = user.apps(Application(app_list.apps_yml).apps)

    return render_template(
        "dashboard.html", config=app.config, user=user, apps=apps, alerts=None
    ) 
开发者ID:mozilla-iam,项目名称:sso-dashboard,代码行数:9,代码来源:app.py

示例7: styleguide_notifications

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def styleguide_notifications():
    user = FakeUser(config.Config(app).settings)
    return render_template("notifications.html", config=app.config, user=user) 
开发者ID:mozilla-iam,项目名称:sso-dashboard,代码行数:5,代码来源:app.py

示例8: notifications

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def notifications():
    user = User(session, config.Config(app).settings)
    return render_template("notifications.html", config=app.config, user=user) 
开发者ID:mozilla-iam,项目名称:sso-dashboard,代码行数:5,代码来源:app.py

示例9: alert_operation

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def alert_operation(alert_id):
    if request.method == "POST":
        user = User(session, config.Config(app).settings)
        if request.data is not None:
            data = json.loads(request.data.decode())
            helpfulness = data.get("helpfulness")
            alert_action = data.get("alert_action")

        result = user.take_alert_action(alert_id, alert_action, helpfulness)

        if result["ResponseMetadata"]["HTTPStatusCode"] == 200:
            return "200"
        else:
            return "500" 
开发者ID:mozilla-iam,项目名称:sso-dashboard,代码行数:16,代码来源:app.py

示例10: __init__

# 需要导入模块: from logging import config [as 别名]
# 或者: from logging.config import Config [as 别名]
def __init__(self, cookies_path, config_path, max_retries=5, memory_file=None):
        self.Exceptions = HangupsBotExceptions()

        self.shared = {} # safe place to store references to objects

        self.bridges = {} # WebFramework will register bridges here by uid

        self._client = None
        self._cookies_path = cookies_path
        self._max_retries = max_retries

        # These are populated by on_connect when it's called.
        self._conv_list = None # hangups.ConversationList
        self._user_list = None # hangups.UserList
        self._handlers = None # handlers.py::EventHandler

        self._cache_event_id = {} # workaround for duplicate events

        self._locales = {}

        # Load config file
        try:
            self.config = config.Config(config_path)
        except ValueError:
            logging.exception("failed to load config, malformed json")
            sys.exit()

        # set localisation if anything defined in config.language or ENV[HANGOUTSBOT_LOCALE]
        _language = self.get_config_option('language') or os.environ.get("HANGOUTSBOT_LOCALE")
        if _language:
            self.set_locale(_language)

        # load in previous memory, or create new one
        self.memory = None
        if memory_file:
            _failsafe_backups = int(self.get_config_option('memory-failsafe_backups') or 3)
            _save_delay = int(self.get_config_option('memory-save_delay') or 1)

            logger.info("memory = {}, failsafe = {}, delay = {}".format(
                memory_file, _failsafe_backups, _save_delay))

            self.memory = config.Config(memory_file, failsafe_backups=_failsafe_backups, save_delay=_save_delay)
            if not os.path.isfile(memory_file):
                try:
                    logger.info("creating memory file: {}".format(memory_file))
                    self.memory.force_taint()
                    self.memory.save()

                except (OSError, IOError) as e:
                    logger.exception('FAILED TO CREATE DEFAULT MEMORY FILE')
                    sys.exit()

        # Handle signals on Unix
        # (add_signal_handler is not implemented on Windows)
        try:
            loop = asyncio.get_event_loop()
            for signum in (signal.SIGINT, signal.SIGTERM):
                loop.add_signal_handler(signum, lambda: self.stop())
        except NotImplementedError:
            pass 
开发者ID:hangoutsbot,项目名称:hangoutsbot,代码行数:62,代码来源:hangupsbot.py


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