title: python twisted HTTP Proxy
body: <p>I am very new to python. I am starting with twisted. As I saw in Twisted documentation, just this can make a proxy server. </p>
  
  <pre><code>class MyProxy(proxy.Proxy):
      pass
  
  class ProxyFactory(http.HTTPFactory):
      protocol = MyProxy
  
  reactor.listenTCP(8080, ProxyFactory())
  reactor.run()
  </code></pre>
  
  <p><code>ProxyFactory::protocol</code> looks like a member variable ? but <code>MyProxy</code> is a typename and I don't know is it a kind of template ? otherwise how can I assign a type into a variable ?</p>
  
  <p>What I actually want to achive is simply reject requests to certain endpoints. I was thinking of overriding <code>buildProtocol</code> But the supplied argument <code>addr</code> is always 127.0.0.1</p>