add sentry to httpbin application

This commit is contained in:
2017-03-19 21:44:32 -04:00
parent 4e7724ca66
commit 7df0b59801
4 changed files with 76 additions and 3 deletions
+4 -1
View File
@@ -4,6 +4,9 @@ verify_ssl = true
[packages]
gunicorn = "*"
Flask = "*"
decorator = "*"
brotlipy = "*"
Flask = "*"
[packages.raven]
extras = [ "flask",]
Generated
+62
View File
@@ -0,0 +1,62 @@
{
"_meta": {
"hash": {
"sha256": "53116ad7b310b08706e5c73063a39d06acc144ee22cf0dc9783758e69556b76a"
},
"requires": {},
"sources": [
{
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"Flask": {
"version": "==0.12"
},
"Jinja2": {
"version": "==2.9.5"
},
"MarkupSafe": {
"version": "==1.0"
},
"Werkzeug": {
"version": "==0.12.1"
},
"blinker": {
"version": "==1.4"
},
"brotlipy": {
"version": "==0.6.0"
},
"cffi": {
"version": "==1.9.1"
},
"click": {
"version": "==6.7"
},
"contextlib2": {
"version": "==0.5.4"
},
"decorator": {
"version": "==4.0.11"
},
"enum34": {
"version": "==1.1.6"
},
"gunicorn": {
"version": "==19.7.0"
},
"itsdangerous": {
"version": "==0.24"
},
"pycparser": {
"version": "==2.17"
},
"raven": {
"version": "==6.0.0"
}
},
"develop": {}
}
+2 -1
View File
@@ -4,5 +4,6 @@
"repository": "https://github.com/Runscope/httpbin",
"website": "https://httpbin.org",
"logo": "https://s3.amazonaws.com/f.cl.ly/items/333Y191Z2C0G2J3m3Y0b/httpbin.svg",
"keywords": ["http", "rest", "API", "testing", "integration", "python", "flask"]
"keywords": ["http", "rest", "API", "testing", "integration", "python", "flask"],
"addons": "sentry"
}
+8 -1
View File
@@ -16,10 +16,11 @@ import uuid
import argparse
from flask import Flask, Response, request, render_template, redirect, jsonify as flask_jsonify, make_response, url_for
from six.moves import range as xrange
from werkzeug.datastructures import WWWAuthenticate, MultiDict
from werkzeug.http import http_date
from werkzeug.wrappers import BaseResponse
from six.moves import range as xrange
from raven.contrib.flask import Sentry
from . import filters
from .helpers import get_headers, status_code, get_dict, get_request_range, check_basic_auth, check_digest_auth, secure_cookie, H, ROBOT_TXT, ANGRY_ASCII
@@ -50,6 +51,12 @@ BaseResponse.autocorrect_location_header = False
tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
app = Flask(__name__, template_folder=tmpl_dir)
app.debug = bool(os.environ.get('DEBUG'))
# Send app errors to Sentry.
if 'SENTRY_DSN' in os.environ:
sentry = Sentry(app, dsn=os.environ('SENTRY_DSN'))
# Set up Bugsnag exception tracking, if desired. To use Bugsnag, install the
# Bugsnag Python client with the command "pip install bugsnag", and set the