Honeybadger Python is the official client library for sending Python and Django errors to Honeybadger.io. It provides real-time error tracking, uptime monitoring, and performance insights for applications built with frameworks like Django, Flask, and Celery, as well as general Python applications and AWS Lambda functions. The library is actively maintained, with version 1.2.2 being the latest, and receives frequent updates including bug fixes and minor features.
pip install honeybadgerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic initialization using an API key (preferably from an environment variable) and how to manually send an exception to Honeybadger. For immediate reporting in short-lived scripts, `force_sync=True` is recommended. Remember to replace `HONEYBADGER_API_KEY` with your actual API key from your Honeybadger project settings.
Ensure `honeybadger.configure(api_key='YOUR_API_KEY')` is called, or the `HONEYBADGER_API_KEY` environment variable is set. Errors won't be sent without a valid API key.
When calling `honeybadger.notify()`, explicitly set `force_sync=True` (e.g., `honeybadger.notify(exception, force_sync=True)`) to ensure the HTTP request completes before the process exits.
For Django, add `'honeybadger.contrib.django'` to `INSTALLED_APPS` and configure it in `settings.py`. For Flask, initialize `Honeybadger` from `honeybadger.contrib.flask` with your Flask app (e.g., `hb = Honeybadger(app=my_flask_app)`).
Update `honeybadger.init(...)` calls to `honeybadger.configure(...)`.
Set the `HONEYBADGER_API_KEY` environment variable or explicitly pass `api_key='YOUR_KEY'` to `honeybadger.configure()`.
Add `force_sync=True` to your `honeybadger.notify()` call: `honeybadger.notify(e, force_sync=True)`.
Pass configuration options as individual keyword arguments: `honeybadger.configure(api_key='...', environment='production', ...)` instead of `honeybadger.configure(config={'api_key': '...'})`.