{ "html": "
\n

Installation

\n

If you haven’t already, start by downloading Raven. The easiest way is\nwith pip:

\n
pip install raven --upgrade\n
\n
\n
\n\n\n
\n

Setup

\n

The first thing you’ll need to do is to disable catchall in your Bottle app:

\n
import bottle\n\napp = bottle.app()\napp.catchall = False\n
\n
\n
\n

Note

\n

Bottle will not propagate exceptions to the underlying WSGI\nmiddleware by default. Setting catchall to False disables that.

\n
\n

Sentry will then act as Middleware:

\n
from raven import Client\nfrom raven.contrib.bottle import Sentry\nclient = Client('___DSN___')\napp = Sentry(app, client)\n
\n
\n
\n\n\n
\n

Usage

\n

Once you’ve configured the Sentry application you need only call run with it:

\n
run(app=app)\n
\n
\n

If you want to send additional events, a couple of shortcuts are provided\non the Bottle request app object.

\n

Capture an arbitrary exception by calling captureException:

\n
try:\n    1 / 0\nexcept ZeroDivisionError:\n    request.app.sentry.captureException()\n
\n
\n

Log a generic message with captureMessage:

\n
request.app.sentry.captureMessage('Hello, world!')\n
\n
\n
\n", "link": "https://docs.getsentry.com/clients/python/integrations/bottle/", "id": "python-bottle", "name": "Bottle" }