Skip to content

Instantly share code, notes, and snippets.

@wynemo
Created March 21, 2012 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wynemo/2149495 to your computer and use it in GitHub Desktop.
Save wynemo/2149495 to your computer and use it in GitHub Desktop.
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)
@DrBob5188
Copy link

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