class documentation

class twisted.web.server.Site(http.HTTPFactory): (source)

Implements interfaces: twisted.internet.interfaces.IProtocolNegotiationFactory

View In Hierarchy

A web site: manage log, sessions, and resources.

Instance Variable counter increment value used for generating unique sessions ID.
Instance Variable requestFactory A factory which is called with (channel) and creates Request instances. Default to Request.
Instance Variable displayTracebacks If set, unhandled exceptions raised during rendering are returned to the client as HTML. Default to False.
Instance Variable sessionFactory factory for sessions objects. Default to Session.
Instance Variable sessionCheckTime Deprecated. See Session.sessionTimeout instead.
Method __init__ No summary
Instance Variable sessions Undocumented
Instance Variable resource Undocumented
Method __getstate__ Undocumented
Method makeSession Generate a new Session instance, and store it for future reference.
Method getSession Get a previously generated session.
Method buildProtocol Generate a channel attached to this site.
Class Variable isLeaf Undocumented
Method render Redirect because a Site is always a directory.
Method getChildWithDefault Emulate a resource's getChild method.
Method getResourceFor Get a resource for a request.
Method acceptableProtocols Protocols this server can speak.
Method _openLogFile Override in subclasses, e.g. to use twisted.python.logfile.
Method _mkuid (internal) Generate an opaque, unique ID for a user's session.

Inherited from HTTPFactory:

Instance Variable logPath Undocumented
Instance Variable timeOut Undocumented
Method startFactory Set up request logging if necessary.
Instance Variable logFile Undocumented
Method stopFactory This will be called before I stop listening on all Ports/Connectors.
Method log Write a line representing request to the access log file.
Instance Variable _logDateTime A cached datetime string for log messages, updated by _logDateTimeCall.
Instance Variable _logDateTimeCall A delayed call for the next update to the cached log datetime string.
Instance Variable _logFormatter See the logFormatter parameter to __init__
Instance Variable _nativeize A flag that indicates whether the log file being written to wants native strings (True) or bytes (False). This is only to support writing to twisted.python.log which, unfortunately, works with native strings.
Instance Variable _reactor An IReactorTime provider used to compute logging timestamps.
Method _updateLogDateTime Update log datetime periodically, so we aren't always recalculating it.

Inherited from Factory (via HTTPFactory, ServerFactory):

Class Variable protocol Undocumented
Instance Variable numPorts Undocumented
Class Variable noisy Undocumented
Class Method forProtocol Create a factory for the given protocol.
Method logPrefix Describe this factory for log messages.
Method doStart Make sure startFactory is called.
Method doStop Make sure stopFactory is called.
counter = (source)
increment value used for generating unique sessions ID.
requestFactory = (source)
A factory which is called with (channel) and creates Request instances. Default to Request.
displayTracebacks = (source)
If set, unhandled exceptions raised during rendering are returned to the client as HTML. Default to False.
(type: bool)
sessionFactory = (source)
factory for sessions objects. Default to Session.
sessionCheckTime = (source)
Deprecated. See Session.sessionTimeout instead.
(type: int)
def __init__(self, resource, requestFactory=None, *args, **kwargs): (source)
ParametersresourceThe root of the resource hierarchy. All request traversal for requests received by this factory will begin at this resource. (type: IResource provider)
requestFactoryOverwrite for default requestFactory. (type: callable or class.)
argsUndocumented
kwargsUndocumented
See Alsotwisted.web.http.HTTPFactory.__init__
sessions = (source)

Undocumented

(type: dict)
resource = (source)

Undocumented

def _openLogFile(self, path): (source)

Override in subclasses, e.g. to use twisted.python.logfile.

def __getstate__(self): (source)

Undocumented

def _mkuid(self): (source)

(internal) Generate an opaque, unique ID for a user's session.

def makeSession(self): (source)

Generate a new Session instance, and store it for future reference.

def getSession(self, uid): (source)

Get a previously generated session.

ParametersuidUnique ID of the session. (type: bytes.)
RaisesKeyErrorIf the session is not found.
def buildProtocol(self, addr): (source)

Generate a channel attached to this site.

isLeaf = (source)

Undocumented

(type: int)
def render(self, request): (source)

Redirect because a Site is always a directory.

def getChildWithDefault(self, pathEl, request): (source)

Emulate a resource's getChild method.

def getResourceFor(self, request): (source)

Get a resource for a request.

This iterates through the resource hierarchy, calling getChildWithDefault on each resource it finds for a path element, stopping when it hits an element where isLeaf is true.

def acceptableProtocols(self): (source)

Protocols this server can speak.

API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.