# ``twisted`.`web`.`server`.`Session``

class documentation

`class Session(components.Componentized): (source)`

View In Hierarchy

A user's session with a system.

This utility class contains no functionality, but is used to represent a session.

Method | `__init__` | Initialize a session with a unique ID for that session.
Method | `expire` | Expire/logout of the session.
Method | `notifyOnExpire` | Call this callback when the session expires or logs out.
Method | `startCheckingExpiration` | Start expiration tracking.
Method | `touch` | Mark the session as modified, which resets expiration timer.
Instance Variable | `expireCallbacks` | Undocumented
Instance Variable | `lastModified` | Time the `touch()` method was last called (or time the session was created). A UNIX timestamp as returned by `IReactorTime.seconds()`.
Instance Variable | `sessionNamespaces` | Undocumented
Instance Variable | `sessionTimeout` | Time after last modification the session will expire, in seconds.
Instance Variable | `site` | The `Site` that generated the session.
Instance Variable | `uid` | A unique identifier for the session.
Instance Variable | `_expireCall` | Undocumented
Instance Variable | `_reactor` | An object providing `IReactorTime` to use for scheduling expiration.

Inherited from `Componentized`:

Method | `__conform__` | Undocumented
Method | `addAdapter` | Utility method that calls addComponent. I take an adapter class and instantiate it with myself as the first argument.
Method | `addComponent` | Add a component to me, for all appropriate interfaces.
Method | `getComponent` | Create or retrieve an adapter for the given interface.
Method | `locateAdapterClass` | Undocumented
Method | `removeComponent` | Remove the given component from me entirely, for all interfaces for which it has been registered.
Method | `setAdapter` | Cache a provider for the given interface, by adapting `self` using the given adapter class.
Method | `setComponent` | Cache a provider of the given interface.
Method | `unsetComponent` | Remove my component specified by the given interface class.
Class Variable | `persistenceVersion` | Undocumented
Instance Variable | `_adapterCache` | Undocumented

def __init__(self, site, uid, reactor=None): (source)
overrides `twisted.python.components.Componentized.__init__`
Initialize a session with a unique ID for that session.

Parameters
site | Undocumented
uid | Undocumented
reactor | `IReactorTime` used to schedule expiration of the session. If `None`, the reactor associated with site is used.

def expire(self): (source)
Expire/logout of the session.
def notifyOnExpire(self, callback): (source)
Call this callback when the session expires or logs out.
def startCheckingExpiration(self): (source)
Start expiration tracking.

Returns
`None`

def touch(self): (source)
Mark the session as modified, which resets expiration timer.
expireCallbacks: `list` = (source)

Undocumented

lastModified: `float` = (source)
Time the `touch()` method was last called (or time the session was created). A UNIX timestamp as returned by `IReactorTime.seconds()`.
sessionNamespaces: `dict` = (source)

Undocumented

sessionTimeout: `float` = (source)
Time after last modification the session will expire, in seconds.
site: `Site` = (source)
The `Site` that generated the session.
uid: `bytes` = (source)
A unique identifier for the session.
_expireCall = (source)

Undocumented

_reactor = (source)
An object providing `IReactorTime` to use for scheduling expiration.