It's all spinning wheels and self-doubt until the first pot of coffee.

Sharing my Python proxy experiment

Anthony Eden writes:

I was so intrigued by having a proxy agent which would work for me that I wrote a little generic pluggable proxy this morning.
Show us the code! :) I want to play.

As for my code so far: This is extremely premature, and I'm not even sure if it will work anywhere besides my peculiar iBook, but here's a quick & dirty tarball of my experiments with a PersonalWebProxy (just web, not universal) with a simple plugin API, in Python using Twisted:


It's poorly commented, doesn't do much useful, but it's a few nights' work by someone just getting acquainted with Twisted - if you're even worse off than me and want to poke at this proxy thing, maybe this will help you. It does do a few things I thought were nifty, like use Mark Pilgrim's rssfinder script in a thread to dig up RSS feeds for every URL with text/html content you visit. There's no persistence yet, so they just appear in the log, but figuring out the integration and thread use so far was nifty to me.

Anyway, enjoy. I'm still tinkering, thinking, and working up a plan.

Oh yeah, and I'm watching Dick Clark and the ball drop with my girlfriend, so this post brings an end to hacking for the night.


Archived Comments

  • I've got it going under Mandrake 9.0. If i run it directly out of eclipse with the python plugin it runs, if i run it from the command line, I had to change the LOG_PATH to the full path. When it starts i get: [003382 INFO Unknown module] Proxy coming up on port 8813. Enabling Multithreading. dbproxy.proxy.ProxyFactory starting on 8813
  • Thank you! I was hoping you would release cold, hard code soon so I could hack on it. And hack on it I did. I am very excited about this project. I think it's going to be of real value very quickly. I added a Service instance which stores the links harvested by RSSFinder in a dictionary, and I wrote a web interface that starts a server on 8080 and serves a woven page that displays the dictionary along with all the links. Piece of cake. EXCITING I'll email you my code.