Made 404 errors more API friendly
This commit is contained in:
parent
b9410785e0
commit
0418afbdc5
1 changed files with 7 additions and 1 deletions
|
|
@ -14,7 +14,8 @@ import datetime
|
|||
|
||||
from flask import (
|
||||
Flask, render_template, Response,
|
||||
redirect, request, jsonify, send_file, abort)
|
||||
redirect, request, jsonify, send_file, abort,
|
||||
make_response)
|
||||
|
||||
|
||||
import numpy as np
|
||||
|
|
@ -29,6 +30,11 @@ import logging, sys
|
|||
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
||||
|
||||
|
||||
# Make errors more API friendly
|
||||
@app.errorhandler(404)
|
||||
def not_found(error):
|
||||
return make_response(jsonify({'error': 'Not found'}), 404)
|
||||
|
||||
# Create the microscope object globally (common to all spawned server threads)
|
||||
microscope = Microscope(
|
||||
StreamingCamera(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue