0

I am a python newbie and i have a controler that get Post requests. I try to print to log file the request that it receive, i am able to print the body but how can i extract all the request include the headers? I am using request.POST.get() to get the body/data from the request.

Thanks

Barak
  • 21
  • 3

2 Answers2

0

To get request headers, you can use request.META, as it returns dictionary containing all available HTTP headers.

headers = request.META
Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
-1

request.POST should give you the POST body if it is get use request.GET if the request body is json use request.data