Created
March 28, 2013 13:25
-
-
Save srounet/5263101 to your computer and use it in GitHub Desktop.
Test Haproxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import json | |
html = urllib2.urlopen('http://www.jsonip.com').read() | |
print "Normal ip: %s" % json.loads(html)['ip'] | |
proxy_support = urllib2.ProxyHandler({"http":"http://127.0.0.1:8123"}) | |
opener = urllib2.build_opener(proxy_support) | |
urllib2.install_opener(opener) | |
html = urllib2.urlopen("http://www.jsonip.com").read() | |
print "Proxy ip: %s" % json.loads(html)['ip'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment