Skip to content

Instantly share code, notes, and snippets.

View comet0's full-sized avatar

Cometo comet0

View GitHub Profile
@comet0
comet0 / proxy.py
Last active August 29, 2015 14:26 — forked from bxt/proxy.py
A very basic caching python HTTP proxy server.
# Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/
#
# Usage:
# A call to http://localhost:80000/example.com/foo.html will cache the file
# at http://example.com/foo.html on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib