pyfarm.agent.http.core.server module

HTTP Server

HTTP server responsible for serving requests that control or query the running agent. This file produces a service that the pyfarm.agent.manager.service.ManagerServiceMaker class can consume on start.

class pyfarm.agent.http.core.server.RewriteRequest(*args, **kw)[source]

Bases: twisted.web.server.Request

A custom implementation of _Request that will allow us to modify an incoming request before it reaches the HTTP server..

REPLACE_REPEATED_DELIMITER = <_sre.SRE_Pattern object at 0x7f9c44b77a50>
requestReceived(command, path, version)[source]

Override the built in _Request.requestReceived() so we can rewrite portions of the request, such as the url, before it’s passed along to the internal server.

write(data)[source]

Override the built in _Request.write() so that any data that’s not a string will be dumped to json using dumps()

class pyfarm.agent.http.core.server.Site(resource, *args, **kwargs)[source]

Bases: twisted.web.server.Site

Site object similar to Twisted’s except it also carries along some of the internal agent data.

displayTracebacks = True
requestFactory

alias of RewriteRequest

class pyfarm.agent.http.core.server.StaticPath(*args, **kwargs)[source]

Bases: twisted.web.static.File

More secure version of File that does not list directories. In addition this will also sending along a response header asking clients to cache to data.

EXPIRES = 604800
ALLOW_DIRECTORY_LISTING = False
render(request)[source]

Overrides File.render() and sets the expires header

directoryListing()[source]

Override which ensures directories cannot be listed