Raven Client for Sentry

6.10.0 · maintenance · verified Fri Apr 10

Raven is the legacy Python client for Sentry, providing error and exception tracking for Python applications. It offers integrations for frameworks like Django and Flask, and supports general WSGI applications. The library is currently in maintenance mode, with new feature development and most bug fixes now occurring exclusively in the successor `sentry-sdk` library.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Raven client with a DSN and then capture an exception and a simple message. Replace the placeholder DSN with your actual Sentry DSN.

import os
from raven import Client

# Get your DSN from Sentry (e.g., from environment variables)
dsn = os.environ.get('SENTRY_DSN', 'https://examplePublicKey@o0.ingest.sentry.io/0')

# Initialize the Raven client
client = Client(dsn)

try:
    1 / 0
except ZeroDivisionError:
    client.captureException()
    print("Error captured by Raven (check your Sentry dashboard).")

client.captureMessage('This is a test message from Raven.')
print("Message captured by Raven.")

view raw JSON →