[Answer]-What is request._cookies in django?

1👍

A HTTP Cookie is data that is initially sent from the website and stored on a user’s browser. This data is persistently stored, you can take a look at your cookies right now:

enter image description here

enter image description here

As you can see, stackoverflow stores these cookies, and when you send a request to the server, you can the request can include data from the cookies. The _cookies accesses these cookies.

You couldn’t find it in the docs because it doesn’t exist, the original creator of the script might have chosen to add a separate attribute, this is unclear since we cannot see the views.py file itself. The only attribute for a HTTPRequest that is relevant to what you’re asking is HTTPRequest.COOKIES, which is a python dictionary of values.

Leave a comment