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 best free ide for python?

432


How are arguments passed by value or by reference?

545


Explain list, tuple, set, and dictionary and provide at least one instance where each of these collection types can be used.

525


How do you iterate over a list and pull element indices at the same time?

655


What is dictionary in python?

507






What is python? What do you understand of pep 8?

411


How to save an image locally using python whose url address I already know?

468


Which linux is best for python programming?

429


What is n in python?

459


Difference between @staticmethod and @classmethod in python?

495


How do I run a python script in windows 10?

439


How do I run python?

456


What is composition in python?

514


Differentiate *args and **kwargs?

463


What is the encapsulation?

470