the idea is that, say a developer has a set of tests to run against locahost:8000 and he has hardcoded that in his tests. 
When we setup a proxy in a browser, the browser handles the proxy so that users only care about typing localhost:8000 instead of localhost:proxy_port. Browser actually sends request and receives response from the proxy port.
Can we simulate such so that the tests don't have to change to localhost:proxy_port (and the proxy server knows to route to port 8000). instead, the developer can continue to run as localhost:8000 in his tests, but when he's running his tests, the request automatically goes through the proxy server.
PS: Also without changing the port of the server. Since the assumption is that the port 8000 is running as application server and changing it to another port can break other things! So saying "change proxy server port to 8000 and my webapp server to 80001" doesn't solve the whole problem.
Set the HTTP_PROXY environment variable (and export it), and Python will honour that (as far as the standard library is used).
Can we simulate a browser proxy mechanism in a Python script?