Set up multiple session handlers on python webapp2
<p>I'm writing a simple web application in google appengine and python. In this application I need to handle two types of sessions:
the "long term session" that stores information about users, current page ecc, with long max_age parameter and the "short term session" with max_age about 20 minutes that keep an access token for the autentication via API.</p>

<p>I have implemented the following BaseHandler:</p>

<p><pre>import webapp2
from webapp2_extras import sessions</p>

<p>class BaseHandler(webapp2.RequestHandler):</p>

<code>def dispatch(self):
    # Get a session store for this request.
    self.session_store = sessions.get_store(request=self.request)

    try:
        # Dispatch the request.
        webapp2.RequestHandler.dispatch(self)
    finally:
        # Save all sessions.
        self.session_store.save_sessions(self.response)

@webapp2.cached_property
def session(self):
    # Returns a session using the default cookie key.
    return self.session_store.get_session(backend='memcache')

@webapp2.cached_property
def session_auth(self):
    return self.session_store.get_session(backend='memcache', max_age=20*60)&lt;code&gt;
</code></pre>

<p>the problem is that all sessions have max_age=20*60 seconds (and not only the sessions accessible by self.session_auth)..
How should I solve this?</p>

<p>thanks</p>

<p>Try setting your config params: </p>

<pre><code>config = {}
config['webapp2_extras.sessions'] = {
    'session_max_age': 100000,   # try None here also, though that is the default
}

app = webapp2.WSGIApplication([
    ('/', HomeHandler),
], debug=True, config=config)
</code></pre>

python google-app-engine session webapp2