adambyrtek / airbrake-flask

Airbrake client for Python Flask Microframework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

airbrake-flask

Airbrake client for Python Flask Microframework

Build Status Coverage Status Downloads Version

License

Licensed under the MIT License.

Testing / Coverage

To run tests, you need to install some required packages. Remember to activate your virtualenv first.

# install required packages for test
$ pip install -e .[test]

# run test
$ make test

# generate coverage report
$ make cover

Example Usage with gevent

from flask import Flask, request, got_request_exception
from airbrake.airbrake import AirbrakeErrorHandler
import gevent
import sys
	
app = Flask(__name__)
ENV = ('ENV' in os.environ and os.environ['ENV']) or 'prod'

def log_exception(error):
	handler = AirbrakeErrorHandler(api_key="PUT_YOUR_AIRBRAKE_KEY_HERE",
									env_name=ENV,
									request=request)
	gevent.spawn(handler.emit, error, sys.exc_info())

got_request_exception.connect(log_exception, app)

About

Airbrake client for Python Flask Microframework

License:MIT License


Languages

Language:Python 95.2%Language:Makefile 4.8%