本文整理汇总了Python中raven.Client.build_msg方法的典型用法代码示例。如果您正苦于以下问题:Python Client.build_msg方法的具体用法?Python Client.build_msg怎么用?Python Client.build_msg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类raven.Client
的用法示例。
在下文中一共展示了Client.build_msg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sanitize_real_exception
# 需要导入模块: from raven import Client [as 别名]
# 或者: from raven.Client import build_msg [as 别名]
def test_sanitize_real_exception(self):
client = Client(
'http://user:[email protected]/123',
processors=('raven.processors.SanitizePasswordsProcessor',)
)
try:
password = 'supah secret!'
1 / 0
except Exception as ex:
password = 'supah secret!'
result = client.build_msg('Exception')
pre_context = result['sentry.interfaces.Stacktrace']['frames'][0]['pre_context']
for value in pre_context:
self.assertFalse(password in value)
示例2: report_exception
# 需要导入模块: from raven import Client [as 别名]
# 或者: from raven.Client import build_msg [as 别名]
def report_exception():
# We don't report if this is run from a test, run directly from the source
if 'nosetests' in sys.argv[0]:
return
if sys.argv[0].endswith('.py'):
return
# We use raven to get the stack trace information, but we don't use raven to report
# because client side, reporting doesn't work python. We need to include a secret
# key to report, and we don't want to check in the secret key to github
Client.register_scheme('custom+https', CustomTransport)
client = Client('custom+https://[email protected]/666')
data = client.build_msg('raven.events.Exception')
requests.post(
"https://forms.hubspot.com/uploads/form/v2/327485/2310f9fb-c192-40f2-b191-bf0b1cbcff76",
headers={
'content_type': "application/x-www-form-urlencoded"
},
data={"email": str(uuid4()) + "[email protected]", "json_blob": pformat(data)},
verify=False
)