[Twisted-Python] [Tutor] Help on personnal Proxy

POYEN OP Olivier (DCL) Olivier.POYEN at clf-dexia.com
Mon May 26 12:55:54 EDT 2003


Hi all, 


I tried to read some parts of the how-to, tried to google around in order to create a simple personnal web proxy with no luck. 

For now, I don't want to do anything special, but having a proxy on my localhost, watching for my connections. Later, I may want to enhance its functionnality (a la "proxomitron")

I thought that twisted may certainly be the perfect tool to do that, and I thought this would be a good way to start using it. 

I know about the proxy class, but, when I try to use it:

(taken from Proxy class docstring):

from twisted.protocols import http
from twisted.web import proxy
from twisted.internet import reactor


f=http.HTTPFactory()
f.HTTPChannel=proxy.Proxy
reactor.listenTCP(8765,f)
reactor.run()

I then try an 'export http_proxy=http://localhost:8765' and 
wget http://localhost:8080 (where a nice twisted.web server is waiting)

Not working. 
Even a telnet on port 8765 shown that nothing is responding.

I then thougt about proxy.Proxy which perhaps need to be instanciated:

f.HTTPChannel=proxy.Proxy()

Same punition.

Then, I thougth that I certainly need to subclass my proxy to have it do some stuff: 

class myProx(proxy.Proxy):
    def connectionMade(self,*args):
        print "cool...."

    def dataReceived(self,*args):
        print args

I then again try with myProx *and*ù myProx().
Nothing worked.


Well, I search for anything on the mailing list archive, but with no luck.


Do I have to say that any help or RTFM would be appreciated ! 


Thanx in advance,


OPQ
-------------- next part --------------
-----------------------------------------------------------------

Ce message est confidentiel ; son contenu ne represente en aucun

cas un engagement de la part de Dexia Credit Local ou de Dexia

CLF Banque. Toute publication, utilisation ou diffusion, meme

partielle, doit etre autorisee prealablement par l'emetteur. Si

vous n'etes pas destinataire de ce message, merci d'en avertir

immediatement l'expediteur.



This message is confidential ; its contents do not constitute a

commitment by Dexia Credit Local or Dexia CLF Banque. Any

unauthorised disclosure, use or dissemination, either whole or

partial, is prohibited. If you are not the intended recipient of

the message, please notify the sender immediately.

-----------------------------------------------------------------

Consultez notre site internet www.dexia-clf.fr

La cle d'une gestion optimisee du secteur public local

-----------------------------------------------------------------


More information about the Twisted-Python mailing list