Skip to content

Instantly share code, notes, and snippets.

@pgiraud
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save pgiraud/6dee4013dcba87fb0f76 to your computer and use it in GitHub Desktop.

Select an option

Save pgiraud/6dee4013dcba87fb0f76 to your computer and use it in GitHub Desktop.
Python script to test connection behind proxy
import httplib2
httplib2.debuglevel = 4
PROXY_SERVER = "http://proxy.iiit.ac.in"
PROXY_PORT = 8080
PROXY = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP, PROXY_SERVER, PROXY_PORT, proxy_rdns=True)
h = httplib2.Http(proxy_info=PROXY)
(resp_headers, content) = h.request("http://example.org/", "GET")
print content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment