[ANN] Initial release of Throxy: throttling HTTP proxy in one Python file

Johann C. Rocholl johann at browsershots.org
Sun Feb 11 17:02:59 CET 2007


Throxy: throttling HTTP proxy in one Python file

* Simulate a slow connection (like dial-up).
* Adjustable bandwidth limit for download and upload.
* Optionally dump HTTP headers and content for debugging.
* Decompress gzip content encoding for debugging.
* Multiple connections, without threads (uses asyncore).
* Only one source file, written in pure Python.

To use it, run throxy.py on your local machine and adjust your browser
settings to use 127.0.0.1:8080 as HTTP proxy.

Simulate analog modem connection:
$ python throxy.py -u28.8 -d57.6

Show all HTTP headers (request & reply):
$ python throxy.py -qrs

Dump HTTP headers and content to a file, without size limits:
$ python throxy.py -rsRS -l0 -L0 -g0 > dump.txt

Tell command line tools to use the proxy:
$ export http_proxy=127.0.0.1:8080

Command line options:
  --version   show program's version number and exit
  -h, --help  show this help message and exit
  -i <ip>     listen on this interface only (default all)
  -p <port>   listen on this port number (default 8080)
  -d <kbps>   download bandwidth in kbps (default 28.8)
  -u <kbps>   upload bandwidth in kbps (default 28.8)
  -o          allow remote clients (WARNING: open proxy)
  -q          don't show connect and disconnect messages
  -s          dump headers sent to server
  -r          dump headers received from server
  -S          dump content sent to server
  -R          dump content received from server
  -l <bytes>  maximum length of dumped text content (default 1024)
  -L <bytes>  maximum length of dumped binary content (default 256)
  -g <bytes>  maximum size for gzip decompression (default 8192)

Subversion repository (or simple download):
http://svn.browsershots.org/trunk/throxy/throxy.py

Pretty source code (and change history):
http://trac.browsershots.org/browser/trunk/throxy/throxy.py

This is a very early release. Please send feedback per email.
Alternatively, you can file bugs and feature requests here:
http://trac.browsershots.org/newticket?component=throxy

Cheers,
Johann


More information about the Python-announce-list mailing list