se-hub/SE_API/Respones_Utils.py

38 lines
1.2 KiB
Python
Raw Normal View History

2015-06-11 17:59:40 +00:00
__author__ = 'Aran'
from flask import Response
import json
2015-06-14 22:34:04 +00:00
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}),
2015-06-11 17:59:40 +00:00
status=400,
mimetype="application/json")
def forbidden(message='Forbidden'):
return Response(response=json.dumps({'message': message}),
2015-06-11 17:59:40 +00:00
status=403,
mimetype="application/json")