diff --git a/openflexure_microscope/api/v1.py b/openflexure_microscope/api/v1.py index 8c50d524..53b9da62 100644 --- a/openflexure_microscope/api/v1.py +++ b/openflexure_microscope/api/v1.py @@ -30,11 +30,6 @@ 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(), @@ -44,6 +39,11 @@ microscope = Microscope( # Create flask app app = Flask(__name__) +# Make errors more API friendly +@app.errorhandler(404) +def not_found(error): + return make_response(jsonify({'error': 'Not found'}), 404) + # Some useful functions def uri(suffix, base='/api/v1'): return base + suffix