added responses

This commit is contained in:
Aran Zaiger 2015-06-15 01:34:04 +03:00
parent d5354b014e
commit 279d637b82

View file

@ -3,6 +3,29 @@ __author__ = 'Aran'
from flask import Response from flask import Response
import json 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'): def bad_request(message='Bad Request'):
return Response(response=json.dumps({'message': message}), return Response(response=json.dumps({'message': message}),
status=400, status=400,