當前位置: 首頁>>代碼示例>>Python>>正文


Python remote.RemoteConfig類代碼示例

本文整理匯總了Python中raven.conf.remote.RemoteConfig的典型用法代碼示例。如果您正苦於以下問題:Python RemoteConfig類的具體用法?Python RemoteConfig怎麽用?Python RemoteConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了RemoteConfig類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_public_dsn

 def test_get_public_dsn(self):
     res = RemoteConfig(
         base_url='http://example.com',
         project='1',
         public_key='public',
         secret_key='secret',
     )
     public_dsn = res.get_public_dsn()
     assert public_dsn == '//[email protected]/1'
開發者ID:CGenie,項目名稱:raven-python,代碼行數:9,代碼來源:tests.py

示例2: test_options

 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,代碼行數:9,代碼來源:tests.py

示例3: test_https_with_port

 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,代碼行數:9,代碼來源:tests.py

示例4: test_no_secret_key

    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,代碼行數:16,代碼來源:tests.py

示例5: set_dsn

    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,代碼行數:17,代碼來源:base.py

示例6: test_get_public_dsn

 def test_get_public_dsn(self):
     res = RemoteConfig(base_url="http://example.com", project="1", public_key="public", secret_key="secret")
     public_dsn = res.get_public_dsn()
     assert public_dsn == "//[email protected]/1"
開發者ID:getsentry,項目名稱:raven-python,代碼行數:4,代碼來源:tests.py


注:本文中的raven.conf.remote.RemoteConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。