<br>Ok, I&#39;ve read the entire Twisted O&#39;Reilly book and gone through many of the docs and tutorials but I still need a bit of direction.<br><div class="gmail_quote"><br>I&#39;m trying to make a simple web-based proxy.  Similar to the proxy in the Twisted book, but with a web interface.  So I could go to   <a href="http://asdf.com.MYPROXYSITE.com" target="_blank">http://asdf.com.MYPROXYSITE.com</a> and see the contents of <a href="http://asdf.com" target="_blank">asdf.com</a>.  <br>

<br>I have the following code that works well as a browser proxy, but I need to figure out how make it web based.  <br><br>My thoughts are that I need to make an HTTP server and then adjust the address in the protocol before finishing the proxy request.  Am I on the right track?  Does anyone have examples of this? <br>

<br>Should I ditch the Proxy classes all together?<br><br>Thanks for any input.<br><br>Dave Fowler<br><br><br>from twisted.web import proxy, http<br>from twisted.python import log<br>import sys<br>log.startLogging(sys.stdout)<br>

<br>class Proxy(proxy.Proxy):<br>    def __init__(self, *args):<br>        print &quot;inside Proxy&quot;<br>        proxy.Proxy.__init__(self, *args)<br>        print &quot;Proxy: &quot;, self.__dict__<br>        print dir(self)<br>

    <br><br>class ProxyFactory(http.HTTPFactory):  # Receive connections from the client<br>    &quot;&quot;&quot; Receives connections from the client &quot;&quot;&quot;<br>    def __init__(self):  # This function only needed for printing input and stuff<br>

        print &quot;inside proxy factory&quot;<br>        http.HTTPFactory.__init__(self)  <br>        print self.__dict__<br>        print dir(self)<br><br>    def buildProtocol(self, addr):<br>        protocol = Proxy()<br>

        print &quot;making protocol for addr&quot;, addr<br>        print &quot;protocol:&quot;, protocol.__dict__<br>        return protocol<br><br>if __name__ == &quot;__main__&quot;:<br><br>    PROXY_PORT = 8001<br>    <br>

    from twisted.internet import reactor<br>    <br>    reactor.listenTCP(PROXY_PORT, ProxyFactory())<br>    reactor.run()<br><br><br><br><br><br>
</div><br>