Tracking Sessions in a Python CGI app.

Tim Roberts timr at
Fri Sep 5 06:44:16 CEST 2003

"Andrew Chalk" <achalk at> wrote:
>Is there a unique session ID created in a Python CGI app.?

No.  Each transaction in a web server is separate.  There is no concept of

>If not, and I suspect not, what is the best way to keep track of the session
>that loads each web page? I need to store form data from multiple forms
>completed by the user. What is the best way to keep track of which user is

One common way is to generate a random number as a session ID and send it
to the client as a cookie.  Another way is to embed the session ID in a
<input type=hidden> field, but then you have to remember to carry that
forward in ALL the forms.
- Tim Roberts, timr at
  Providenza & Boekelheide, Inc.

More information about the Python-list mailing list