DEV Community

SURYA NARAYANA MURTHY
SURYA NARAYANA MURTHY

Posted on Edited on

403 forbidden error Django restful request.

Add the below statement on top of each and every view function definition (views.py).

@api_view(["POST", "GET"])

eg:

@api_view(["POST", "GET"])
def GivenInput():
   return Response(e.args[0],status.HTTP_400_BAD_REQUEST)

Note*: I don't know any alternative way to make it global throughout the file.

Top comments (0)