removed usage of bottle for handling exceptions for rest api
This commit is contained in:
parent
9b8f2868fd
commit
8d610c99e9
3 changed files with 9 additions and 9 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -8,6 +8,7 @@ Makefile
|
|||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
/config
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
|
@ -16,8 +17,11 @@ configure
|
|||
debian
|
||||
stamp-h1
|
||||
|
||||
# python build directory
|
||||
# python
|
||||
dist
|
||||
*.egg-info
|
||||
.cache
|
||||
*.pyc
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
|
@ -30,16 +34,12 @@ dist
|
|||
coverage.xml
|
||||
|
||||
# python files
|
||||
*.egg-info
|
||||
|
||||
# ignore package files
|
||||
*.rpm
|
||||
*.deb
|
||||
*.tar.gz
|
||||
|
||||
# pytest cache files
|
||||
.cache
|
||||
|
||||
# ignore swap files
|
||||
*.swp
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import os
|
||||
|
||||
from bottle import HTTPError
|
||||
from flask import Flask
|
||||
from flask import jsonify
|
||||
from flask import request
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
import core_utils
|
||||
import emane_routes
|
||||
|
@ -78,9 +78,9 @@ def upload():
|
|||
return jsonify()
|
||||
|
||||
|
||||
@app.errorhandler(HTTPError)
|
||||
@app.errorhandler(HTTPException)
|
||||
def handle_error(e):
|
||||
return jsonify(message=e.body, status=e.status_code), e.status_code
|
||||
return jsonify(message=e.description, status=e.code), e.code
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -2,7 +2,7 @@ import os
|
|||
from functools import wraps
|
||||
from threading import Lock
|
||||
|
||||
from bottle import abort
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
save_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "uploads")
|
||||
CORE_LOCK = Lock()
|
||||
|
|
Loading…
Add table
Reference in a new issue