{"id":3916,"library":"bugsnag","title":"Bugsnag","description":"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.","status":"active","version":"4.8.1","language":"en","source_language":"en","source_url":"https://github.com/bugsnag/bugsnag-python","tags":["error-monitoring","crash-reporting","exception-handling","flask","django","celery","wsgi","asgi"],"install":[{"cmd":"pip install bugsnag","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python versions >=3.5 and <4 for bugsnag v4.x. Earlier Python versions are not supported.","package":"python","optional":false},{"reason":"Used by default for asynchronous error report delivery if installed. If not present, bugsnag falls back to urllib delivery.","package":"requests","optional":true},{"reason":"Required for performance monitoring and distributed tracing, which Bugsnag leverages via OpenTelemetry.","package":"opentelemetry-distro","optional":true},{"reason":"Required for sending OpenTelemetry spans and traces to Bugsnag.","package":"opentelemetry-exporter-otlp","optional":true}],"imports":[{"note":"Main module for configuration and error notification.","symbol":"bugsnag","correct":"import bugsnag"},{"note":"Used to integrate Bugsnag with Python's standard logging framework.","symbol":"BugsnagHandler","correct":"from bugsnag.handlers import BugsnagHandler"}],"quickstart":{"code":"import bugsnag\nimport os\n\nbugsnag.configure(\n    api_key=os.environ.get('BUGSNAG_API_KEY', 'YOUR_API_KEY_HERE'),\n    release_stage='development',\n    project_root=os.path.dirname(os.path.abspath(__file__)),\n)\n\ndef might_fail():\n    raise ValueError(\"This is a test error!\")\n\ntry:\n    might_fail()\nexcept Exception as e:\n    print(f\"Caught an error: {e}. Notifying Bugsnag...\")\n    bugsnag.notify(e)\n    print(\"Notification sent.\")\n\n# To demonstrate unhandled error reporting, you would typically not catch it.\n# For example, simply calling might_fail() outside a try-except block in a WSGI/ASGI app.\n","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade Python to 3.5 or newer. Remove usage of `bugsnag.utils.ThreadLocals`. Review and update any uses of deprecated properties from 2.x which were removed in 4.x.","message":"Migrating from Bugsnag Python 3.x to 4.x requires Python 3.5+. Older Python versions are no longer supported. The `bugsnag.utils.ThreadLocals` utility has been removed.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"To send environment data, set `send_environment=True` in your configuration. Ensure all configuration properties passed to `configure()` are recognized by the library.","message":"The `Configuration.send_environment` option is now `False` by default in v4.x, meaning request context (like environment variables) will not be sent unless explicitly enabled. Setting unknown properties via `bugsnag.configure(**kwargs)` is no longer supported and will cause an error.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Replace `config.use_ssl = True` and `config.endpoint = 'my.example.com'` with `config.endpoint = 'https://my.example.com'`.","message":"In Bugsnag 4.x, `use_ssl` and `Configuration.get_endpoint()` have been deprecated in favor of including the protocol (e.g., `https://`) directly in the `endpoint` configuration option.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"For full coverage, ensure your application runs on Python 3.8+. Alternatively, manually wrap critical thread logic with `try...except` and `bugsnag.notify()` for older Python versions.","message":"Automatic detection of unhandled exceptions in threads relies on `threading.excepthook`, which is only supported in Python 3.8 and above. For older Python 3 versions, unhandled exceptions in non-main threads might not be automatically reported.","severity":"gotcha","affected_versions":"<3.8"},{"fix":"Configure `params_filters` in `bugsnag.configure()` with a list of strings whose matching keys should be filtered from payloads. Example: `bugsnag.configure(params_filters=['password', 'credit_card_number'])`.","message":"It is crucial to use `params_filters` to prevent sensitive data (e.g., passwords, credit card numbers) from being sent to Bugsnag in your error reports.","severity":"gotcha","affected_versions":"All"},{"fix":"Avoid using `from bugsnag import *`. Instead, explicitly import only the necessary symbols (e.g., `import bugsnag` or `from bugsnag import notify`).","message":"The introduction of `__all__` lists in Bugsnag 4.x may affect existing integrations that use `from bugsnag import *` by changing which symbols are exposed during a wildcard import.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}