Skip to main content

Honeybadger extension that can log exceptions raised by Flask or Celery, adding more context than the original honeybadger python library.

Project description


Honeybadger-Extensions extend current Honeybadger Python library to better support Celery & Flask.

It offers:

  • Improved reporting, including details for component, action etc.
  • Easier Honeybadger via Flask’s or Celery’s configuration object.
  • (Optional) Automatic reporting of errors detected by Celery or Flask.


Honeybadger-Extensions provides the install_celery_handler() function which can be used at any time which can be used to initialize both Honeybadger & allow improved Honeybadger reporting. It also offers the HoneybadgerFlask Flask extension that adds more information to Honeybadger logging, as well as automatic logging of errors raised in the view functions.

Example 1: Initialize Celery

In the following example, we will use the install_celery_handler to setup Honeybadger reporting.

from celery import Celery
from honeybadger_extensions import install_celery_handler

celery = Celery(__name__)
    'HONEYBADGER_API_KEY': '<your key>',
    'HONEYBADGER_ENVIRONMENT': 'development'

install_celery_handler(config=celery.conf, report_exceptions=True)

Example 2: Initialize Flask

You can use HoneybadgerFlask extension to load Honeybadger configuration from Flask configuration object.

from flask import Flask, jsonify
from honeybadger_extensions import HoneybadgerFlask

app = Flask(__name__)
app.config['HONEYBADGER_ENVIRONMENT'] = 'development'
app.config['HONEYBADGER_API_KEY'] = '<your key>'
app.config['HONEYBADGER_EXCLUDE_HEADERS'] = 'Authorization, Proxy-Authorization, X-Custom-Key'
app.config['HONEYBADGER_PARAMS_FILTERS'] = 'password, secret, credit-card'

# Setup Honeybadger and listen for exceptions
HoneybadgerFlask(app, report_exceptions=True)

def index():
    a = int(request.args.get('a'))
    b = int(request.args.get('b'))'Dividing two numbers {} {}'.format(a, b))
    return jsonify({'result': a / b})


The easiest way to install it is using pip from PyPI

pip install Honeybadger-Extensions


See the LICENSE file for license rights and limitations (MIT).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Honeybadger-Extensions, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size Honeybadger_Extensions-0.1.0-py3-none-any.whl (9.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Honeybadger-Extensions-0.1.0.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page