Home > Net >  Django request.body format
Django request.body format

Time:07-11

When I try to print request.body, the below is printed

b'----------------------------914826831994362856243559\r\nContent-Disposition: form-data; name="release_date"\r\n\r\n2003-06-01\r\n----------------------------914826831994362856243559\r\nContent-Disposition: form-data; name="fanmodel"\r\n\r\nfan234code\r\n----------------------------914826831994362856243559\r\nContent-Disposition: form-data; name="country_code"\r\n\r\nAO\r\n----------------------------914826831994362856243559--\r\n'

My post request data is available here but along with a lot other data. I want to understand what is that other data and how can I format it ?

CodePudding user response:

What you see is bytestring of the raw HTTP request body - see docs. To retrieve data try to use request.POST or request.GET attribute.

CodePudding user response:

If you are using django, you can access the POST data with request.POST.get('variable_name')

Read more:

  • Related