DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

SURYA NARAYANA MURTHY
SURYA NARAYANA MURTHY

Posted on • Updated 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)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.