开发者

Need some help on Cookie Handling and session in python

开发者 https://www.devze.com 2023-01-29 07:50 出处:网络
I want to set some value to cookie when user visits the homepage so that when he hits some url I\'ll get that value and compare it with what I\'ve stored in db. Now do I have to set the same cookie va

I want to set some value to cookie when user visits the homepage so that when he hits some url I'll get that value and compare it with what I've stored in db. Now do I have to set the same cookie value again to handle the next request(in order to maintain session).

I'm using python on GAE and I couldn't find any session service available. So the way I've chosen is it the correct one? or Is there any other way to recognize the user?

Any tutorial on session maintaining and cookie handling on python will also be very helpful. I'm using python 2.6 with dj开发者_JS百科ango on GAE.

Thanks


Look at gaeutilities. It contains session management stuff.


As mentioned above gaeutilties provides sessions support. If that's what you're looking for overall you may want to check it out.

However, also to answer your question. Cookies set persist between requests, you don't need to keep resetting it unless you the expiration extremely low. If you do not set an expiration the cookie will persist until the browser is closed.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号