Bottle

(New in version 0.7.9)

The Bottle integration adds support for the Bottle Web Framework. Currently it works well with the stable version of Bottle (0.12). However the integration with the development version (0.13) doesn’t work properly.

  1. Install sentry-sdk from PyPI with the bottle extra:

     $ pip install --upgrade 'sentry-sdk[bottle]==0.13.5'
    
  2. To configure the SDK, initialize it with the integration before your app has been initialized:

    import sentry_sdk
    
    from bottle import Bottle, run
    from sentry_sdk.integrations.bottle import BottleIntegration
    
    sentry_sdk.init(
        dsn="___PUBLIC_DSN___",
        integrations=[BottleIntegration()]
    )
    
    app = Bottle()
    

Behavior

  • The Sentry Python SDK will install the Bottle integration for all of your apps. The integration hooks into base Bottle class.

  • All exceptions leading to an Internal Server Error are reported.

  • Request data is attached to all events: HTTP method, URL, headers, form data, JSON payloads. Sentry excludes raw bodies and multipart file uploads. Sentry also excludes personally identifiable information (such as user ids, usernames, cookies, authorization headers, IP addresses) unless you set send_default_pii to True.

Options

You can pass the following keyword arguments to BottleIntegration():

  • transaction_style:

    @app.route("/myurl/<foo>")
    def myendpoint():
        return "ok"
    

    In the above code, you would set the transaction to:

    • /myurl/ if you set transaction_style="url".
    • myendpoint if you set transaction_style="endpoint"

    The default is "endpoint".

On this page