Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
httplib in python 2.7 set proxy
import httplib
c = httplib.HTTPSConnection('localhost',8118)
c.set_tunnel('twitter.com',443)
c.request('GET','/')
r1 = c.getresponse()
print r1.status,r1.reason
data1 = r1.read()
print len(data1)

Thanks for posting this. I don't usually dabble with python and it saved me a great deal of time trying to connect through a proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment