當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。