Skip to content Skip to sidebar Skip to footer

Persisting Webapp2 Sessions On Gae

I am having trouble persisting my session variables in a webapp2 session store, while running on GAE. I have created a super simple app to reproduce the issue: class MainHandler(we

Solution 1:

Since I am fairly new to web technologies and standards, I seem to have missed something:

defsave_session(self, response):
    if self.session isNoneornot self.session.modified:
        return

This is the implementation of SecureCookie. Since the cookie is not saved to the response if it is not modified, I am guessing that per standard/protocol, the backend is not responsible for sending the cookie again, as it should already be on the client. It would be great to find a reference to this.


This proves it (switching to requests.Session()):

>>>s = requests.Session()>>>for i inrange(5):...    r = s.get("http://localhost:11282/")...print r.text...    r = s.post("http://localhost:11282/")...print r.text... 
None
POST
Hi! 
POST
Hi! Hi! 
POST
Hi! Hi! Hi! 
POST
Hi! Hi! Hi! Hi! 
POST
>>>

Post a Comment for "Persisting Webapp2 Sessions On Gae"