Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example cherrypy sentry integration
def register_sentry():
cherrypy.tools.report_to_sentry = cherrypy.Tool('before_error_response', report_to_sentry)
cherrypy.config.update({
'tools.report_to_sentry.on': True
})
def report_to_sentry():
sentry_dsn = settings.sentry_dsn
if not sentry_dsn:
return
client = raven.Client(dsn=sentry_dsn)
client.http_context({
'method': cherrypy.request.method,
'url': '{}/{}'.format(cherrypy.request.base, cherrypy.request.path_info),
'method': cherrypy.request.method,
'data': dict(cherrypy.request.body),
'query_string': cherrypy.request.query_string,
'headers': dict(cherrypy.request.headers),
})
client.captureException()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment