Session cookie in Google App Engine
Is there an easy way to manage session cookies with 开发者_StackOverflowGAE? I just need to auth the user and such.
Thanks.
You can use the Users API to authenticate users - either using Google accounts, or OpenID. If you want sessions without user login, there are a number of libraries, such as gaesessions.
Yes, this is for me the easiest way using Python 2.7.
import Cookie
value_session = "userid (encrypted);time of login"
name_cookie = "sessioncookie"
expires = 2629743 # 1 month in seconds
D = Cookie.SimpleCookie()
D["name_cookie"] = value_session
D["name_cookie"]["path"] = "/"
D["name_cookie"]["expires"] = expires
print(D)
精彩评论