Python SESSION (like php) class
is t开发者_开发技巧here any class to handle a SESSION (like php) in Python? not in django, but I want to use it with PyQt
thank you
The short answer is that there is no $SESSION
variable in Python.
Python tends not to put things in global scope like PHP. Therefore, if you are accessing a user's session id, it will probably be accessed via dot notation module_name.ClassName.session
. If you would like to create a PyQt app that acts as a webserver, you could probably adapt a web framework's implementation.
Others' responses to similar queries suggest implementing sessions via a simple database[1]. You could try assigning unique ids with uuid
, and storing them with tools like sqlite3
or pickle
.
[1] http://ubuntuforums.org/showthread.php?t=859645
Theres a session class with mod_python for apache, that can be a good starting point for making our own class. The class is not very dependent on apache to work.
http://www.modpython.org/
精彩评论