Get SESSION id/key (session_key)
Posted: June 23rd, 2010 | Author: Davo | Filed under: Django | Tags: sessionkey | 4 Comments »You can easily grab the session key/id from the request object
print request.session.session_key
You can easily grab the session key/id from the request object
print request.session.session_key
Very concise and useful.
Can you give a quick example of an application of this? Why might I want to know the session key?
Sure. One user case could be in a shopping cart when a user has not logged in we store the session id as the key to identify that specific user.
Ahhh… Thanks!