The session object can be accessed through Models or Controllers in the same way. Here's how you'd set the email of a logged-in user in the session:

self.session["email"] = email

Once set in the session, this value will be accessible by the same client across requests:

email = self.session["email"]

You can access the session object indirectly in any template as well:

<p>Logged in as {{ }}</p>

If you want to remove the variable from the session just do:

del self.session["email"]


The way a session is persisted is configurable, it can be stored in memory, a file, or a database, for example. To configure the type of session persistence to use, pass the session_c keyword in the app initialization:

import appier

class HelloApp(appier.App):

    def __init__(self):
            session_c = appier.session.FileSession


The following session types are currently available:


To hold the session variables only for the duration of the request's lifecycle (eg: for authenticating the request with an OAuth token), transient session variables can be set using the set_t() method instead. These act just like regular session variables, therefore leveraging every other session-dependent feature for the duration of that request.

To set a transient session value:

self.session.set_t("email", "email")

To retrieve it later on you can just do a regular session value retrieval:

email = self.session["email"]

Or you may want to explicitly state that you are looking for a transient value (will not retrieve regular values):


In case you want to delete it (not necessary in most cases, as it will be discarded at the end of the request):