Describe how to use Sessions for Web python.

Answer Posted / chaitanya

Sessions are the server side version of cookies. While a cookie preserves state at the client side, sessions preserves state at server side.

The session state is kept in a file or in a database at the server side. Each session is identified by a unique session id (SID). To make it possible to the client to identify himself to the server the SID must be created by the server and sent to the client whenever the client makes a request.

Session handling is done through the web.session module in the following manner:

import web.session session = web.session.start( option1, Option2,... )

session['myVariable'] = 'It can be requested'

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of "self" in python

537


Explain the synbtax to split a string in python?

438


How are data types defined in python?

457


What are the built-in types available in python?

467


What ide to use for python?

437






What is casting in python?

506


What is built-in type in python?

466


Is google written in python?

442


What is long in python?

435


Where is python used in real world?

452


How are inheritance and overriding methods are related?

441


What are string literals in python?

530


How can you sort a list in reverse order in python?

494


What is data type set in python and how to work with it?

441


What is meant by r strip() in python?

488