aboutsummaryrefslogtreecommitdiffstats
path: root/moon_orchestrator/moon_orchestrator/http_server.py
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2018-10-05 16:54:37 +0200
committerThomas Duval <thomas.duval@orange.com>2018-10-05 16:58:48 +0200
commit2e35a7e46f0929438c1c206e3116caa829f07dc6 (patch)
tree759a83b3dfefe70faeada1c3af7377f4cd89b8eb /moon_orchestrator/moon_orchestrator/http_server.py
parent2dbe655587ca98b67c1a3e3798c63fd47229adc0 (diff)
Update code to 4.6 official version
Change-Id: Ibd0da0e476e24b2685f54693efc11f7a58d40a62
Diffstat (limited to 'moon_orchestrator/moon_orchestrator/http_server.py')
-rw-r--r--moon_orchestrator/moon_orchestrator/http_server.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/moon_orchestrator/moon_orchestrator/http_server.py b/moon_orchestrator/moon_orchestrator/http_server.py
index 1cb12618..72e12358 100644
--- a/moon_orchestrator/moon_orchestrator/http_server.py
+++ b/moon_orchestrator/moon_orchestrator/http_server.py
@@ -19,7 +19,7 @@ logger = logging.getLogger("moon.orchestrator.http_server")
__API__ = (
Status,
- )
+)
class Server:
@@ -70,7 +70,7 @@ class Root(Resource):
"""
The root of the web service
"""
- __urls__ = ("/", )
+ __urls__ = ("/",)
__methods = ("get", "post", "put", "delete", "options")
def get(self):
@@ -136,10 +136,12 @@ class HTTPServer(Server):
def get_404_json(e):
return jsonify({"result": False, "code": 404, "description": str(e)}), 404
+
self.app.register_error_handler(404, get_404_json)
def get_400_json(e):
return jsonify({"result": False, "code": 400, "description": str(e)}), 400
+
self.app.register_error_handler(400, lambda e: get_400_json)
self.app.register_error_handler(403, exceptions.AuthException)
@@ -163,4 +165,3 @@ class HTTPServer(Server):
@staticmethod
def __filter_str(data):
return data.replace("@", "-")
-