Question

I'm using Beaker Session on Google App Engine to manage persistent data between HTTP requests.

Is it possible to access same session from GET and POST request?

I tried to get access to session object but they are not the same object:

def get(self):
    session = self.request.environ['test.beaker.session']
    ...

def post(self):
    session = self.request.environ['test.beaker.session']
    ...
Was it helpful?

Solution

Take a look at this post talking about implementing something similar: Android: Example for using a cookie from HttpPost for HttpGet

The answer is that you need to make sure that the session cookie is stored on the android client side and is accessible throughout the interaction with your server.

OTHER TIPS

They won't be the same object (object identity) from request to request (remember multiple servers). However with the correct setup the session will be consistent for a users session.

Without a custom backend (datastore or memcache for appengine) you can only use cookie based sessions. If you put something into the session you need to call session.save() or configure it for auto save. Have you done either of these in your code ?

How did you determine they are different, object identity or contents ?

You should provide some more details on how it is setup.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top