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


Python RemoteConfig.from_string方法代码示例

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


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

示例1: test_options

# 需要导入模块: from raven.conf.remote import RemoteConfig [as 别名]
# 或者: from raven.conf.remote.RemoteConfig import from_string [as 别名]
 def test_options(self):
     dsn = "http://foo:[email protected]/1?timeout=1"
     res = RemoteConfig.from_string(dsn)
     assert res.project == "1"
     assert res.base_url == "http://sentry.local"
     assert res.store_endpoint == "http://sentry.local/api/1/store/"
     assert res.public_key == "foo"
     assert res.secret_key == "bar"
     assert res.options == {"timeout": "1"}
开发者ID:getsentry,项目名称:raven-python,代码行数:11,代码来源:tests.py

示例2: test_https_with_port

# 需要导入模块: from raven.conf.remote import RemoteConfig [as 别名]
# 或者: from raven.conf.remote.RemoteConfig import from_string [as 别名]
 def test_https_with_port(self):
     dsn = "https://foo:[email protected]:9000/app/1"
     res = RemoteConfig.from_string(dsn)
     assert res.project == "1"
     assert res.base_url == "https://sentry.local:9000/app"
     assert res.store_endpoint == "https://sentry.local:9000/app/api/1/store/"
     assert res.public_key == "foo"
     assert res.secret_key == "bar"
     assert res.options == {}
开发者ID:getsentry,项目名称:raven-python,代码行数:11,代码来源:tests.py

示例3: test_no_secret_key

# 需要导入模块: from raven.conf.remote import RemoteConfig [as 别名]
# 或者: from raven.conf.remote.RemoteConfig import from_string [as 别名]
    def test_no_secret_key(self):
        dsn = 'https://[email protected]/1'
        res = RemoteConfig.from_string(dsn)
        assert res.project == '1'
        assert res.base_url == 'https://sentry.local'
        assert res.store_endpoint == 'https://sentry.local/api/1/store/'
        assert res.public_key == 'foo'
        assert res.secret_key is None
        assert res.options == {}
        assert res.is_active()

        assert get_auth_header(protocol=7, timestamp=42,
                               client='raven-python/1.0',
                               api_key=res.public_key) == (
            'Sentry sentry_timestamp=42, sentry_client=raven-python/1.0, '
            'sentry_version=7, sentry_key=foo')
开发者ID:ehfeng,项目名称:raven-python,代码行数:18,代码来源:tests.py

示例4: set_dsn

# 需要导入模块: from raven.conf.remote import RemoteConfig [as 别名]
# 或者: from raven.conf.remote.RemoteConfig import from_string [as 别名]
    def set_dsn(self, dsn=None, transport=None):
        if dsn is None and os.environ.get("SENTRY_DSN"):
            msg = "Configuring Raven from environment variable 'SENTRY_DSN'"
            self.logger.debug(msg)
            dsn = os.environ["SENTRY_DSN"]

        if dsn not in self._transport_cache:
            if dsn is None:
                result = RemoteConfig(transport=transport)
            else:
                result = RemoteConfig.from_string(dsn, transport=transport, transport_registry=self._registry)
            self._transport_cache[dsn] = result
            self.remote = result
        else:
            self.remote = self._transport_cache[dsn]

        self.logger.debug("Configuring Raven for host: {0}".format(self.remote))
开发者ID:HPotter,项目名称:raven-python,代码行数:19,代码来源:base.py


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