Python Twisted Examples

For current and complete Twisted documentation, please refer to

This page maintained by Jacob Mathai.

If your OpenSSL ore kerberos header files are not in /usr/include, you may need to supply the -I flag to let the setup script know where to look. The same goes for the libraries of course, use the -L flag. Note that build won't accept these flags, so you have t o run first build_ext and then build! Example:

Simple HTTP Proxy Server (

from twisted.web import proxy, http
from twisted.internet import reactor
from twisted.python import log
import sys
class ProxyFactory(http.HTTPFactory):
    protocol = proxy.Proxy
reactor.listenTCP(8080, ProxyFactory())

[jacob@tux]$ python
/usr/lib/python2.3/site-packages/twisted/web/ DeprecationWarning: twisted.protocols.http has moved to twisted.web.http. See
  from twisted.protocols import http
2005/12/06 21:47 EST [-] Log opened.
2005/12/06 21:47 EST [-] __main__.ProxyFactory starting on 8080
2005/12/06 21:47 EST [-] Starting factory <__main__.ProxyFactory instance at 0xb73577ac>

Twisted-Examples (last edited 2012-01-09 13:41:21 by wireless-72-237-55-2)

Unable to edit the page? See the FrontPage for instructions.