How to write a proxy server in Python? [closed] How to write a proxy server in Python? [closed] python python

How to write a proxy server in Python? [closed]


Good example below on how to do this without the overhead of a framework.

http://www.warriorhut.org/whatwg/websocket-proxy.py


Look at the Twisted framework, particularly Twisted Web. It's all freely available under MIT, so you can build off and/or modify it.

See also Python Twisted Examples.


While Twisted, as recommended by @Matthew, is awesome, easier to learn, understand and modify might be this tiny example -- far away from the "production quality" and scalability that Twisted can offer, but, you could start with it to understand the issues better.

For a wide variety of open-source HTTP proxies written in Python, I recommend this list -- that reference has proxies for all tastes built on top of threading, Twisted, asyncore, and other technologies yet!