Pregunta

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']
    ...
¿Fue útil?

Solución

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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top