本文整理汇总了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'
示例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"}
示例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 == {}
示例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')
示例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))
示例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"