From 279d637b822008d2de3f0f83058fd71604c1ae98 Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Mon, 15 Jun 2015 01:34:04 +0300 Subject: [PATCH] added responses --- SE_API/Respones_Utils.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/SE_API/Respones_Utils.py b/SE_API/Respones_Utils.py index b789974..3fe0e3f 100644 --- a/SE_API/Respones_Utils.py +++ b/SE_API/Respones_Utils.py @@ -3,6 +3,29 @@ __author__ = 'Aran' from flask import Response import json + +def ok(message='OK'): + return Response(response=json.dumps({'message': message}), + status=200, + mimetype="application/json") + +def created(message='Created'): + return Response(response=json.dumps({'message': message}), + status=201, + mimetype="application/json") + +def accepted(message='Accepted'): + return Response(response=json.dumps({'message': message}), + status=202, + mimetype="application/json") + + +def no_content(message='No Content'): + return Response(response=json.dumps({'message': message}), + status=204, + mimetype="application/json") + + def bad_request(message='Bad Request'): return Response(response=json.dumps({'message': message}), status=400,