Connect your Python Application
Connect your Python application to Bugsink to start tracking errors.
Bugsink is compatible with the Sentry SDK. A basic setup is the following:
Step 1: Install the SDK
Install the SDK using pip:
{% code %}:::text
pip install sentry-sdk
{% endcode %}
Step 2: Initialize the SDK
Initialize and configure the SDK with your DSN. Add the following at the start of your application code:
{% code %}:::python
import sentry_sdk
sentry_sdk.init(
"{{ dsn }}",
send_default_pii=True,
max_request_body_size="always",
# Setting up the release is highly recommended. The SDK will try to
# infer it, but explicitly setting it is more reliable:
# release=...,
traces_sample_rate=0,
)
{% endcode %}
Step 3: Verify the setup
To verify that everything is working, raise an exception on purpose and check that it appears in Bugsink.
Put this code somewhere in your application where it can easily be triggered and then trigger it (don't use an interactive shell since the SDK will ignore exceptions raised in it):
{% code %}:::python
raise Exception("Raised Exception on purpose to send it to Bugsink")
{% endcode %}
Further reading