Bugsnag

4.8.1 · active · verified Sat Apr 11

Bugsnag is a comprehensive error monitoring library for Python applications, including frameworks like Django, Flask, and Tornado. It automatically detects and reports unhandled exceptions, and allows for manual reporting of handled errors, providing detailed diagnostic information to a central dashboard. The library is actively maintained, currently at version 4.8.1, with regular updates to support new Python features and integrations.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates basic Bugsnag configuration and how to manually report a handled exception. Ensure `BUGSNAG_API_KEY` is set in your environment or replace the placeholder.

import bugsnag
import os

bugsnag.configure(
    api_key=os.environ.get('BUGSNAG_API_KEY', 'YOUR_API_KEY_HERE'),
    release_stage='development',
    project_root=os.path.dirname(os.path.abspath(__file__)),
)

def might_fail():
    raise ValueError("This is a test error!")

try:
    might_fail()
except Exception as e:
    print(f"Caught an error: {e}. Notifying Bugsnag...")
    bugsnag.notify(e)
    print("Notification sent.")

# To demonstrate unhandled error reporting, you would typically not catch it.
# For example, simply calling might_fail() outside a try-except block in a WSGI/ASGI app.

view raw JSON →