Bottle is a microframework for Python. Raven supports this framework through the WSGI integration.
If you haven’t already, start by downloading Raven. The easiest way is with pip:
pip install raven --upgrade
The first thing you’ll need to do is to disable catchall in your Bottle app:
import bottle app = bottle.app() app.catchall = False
Sentry will then act as Middleware:
from raven import Client from raven.contrib.bottle import Sentry client = Client('___DSN___') app = Sentry(app, client)
Once you’ve configured the Sentry application you need only call run with it:
If you want to send additional events, a couple of shortcuts are provided on the Bottle request app object.
Capture an arbitrary exception by calling
try: 1 / 0 except ZeroDivisionError: request.app.sentry.captureException()
Log a generic message with