circuits.web.servers module

Web Servers

This module implements the several Web Server components.

class circuits.web.servers.BaseServer(bind, encoding='utf-8', secure=False, certfile=None, channel='web', display_banner=True)

Bases: circuits.core.components.BaseComponent

Create a Base Web Server

Create a Base Web Server (HTTP) bound to the IP Address / Port or UNIX Socket specified by the ‘bind’ parameter.

Variables:server – Reference to underlying Server Component
Parameters:bind (Instance of int, list, tuple or str) – IP Address / Port or UNIX Socket to bind to.

The ‘bind’ parameter is quite flexible with what valid values it accepts.

If an int is passed, a TCPServer will be created. The Server will be bound to the Port given by the ‘bind’ argument and the bound interface will default (normally to “0.0.0.0”).

If a list or tuple is passed, a TCPServer will be created. The Server will be bound to the Port given by the 2nd item in the ‘bind’ argument and the bound interface will be the 1st item.

If a str is passed and it contains the ‘:’ character, this is assumed to be a request to bind to an IP Address / Port. A TCpServer will thus be created and the IP Address and Port will be determined by splitting the string given by the ‘bind’ argument.

Otherwise if a str is passed and it does not contain the ‘:’ character, a file path is assumed and a UNIXServer is created and bound to the file given by the ‘bind’ argument.

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

channel = 'web'
display_banner
host
port
secure
class circuits.web.servers.FakeSock
getpeername()
class circuits.web.servers.Server(bind, **kwargs)

Bases: circuits.web.servers.BaseServer

Create a Web Server

Create a Web Server (HTTP) complete with the default Dispatcher to parse requests and posted form data dispatching to appropriate Controller(s).

See: circuits.web.servers.BaseServer

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

class circuits.web.servers.StdinServer(encoding='utf-8', channel='web')

Bases: circuits.core.components.BaseComponent

channel = 'web'
host
port
read(data)
secure
write(sock, data)