Created
March 21, 2012 16:55
-
-
Save wynemo/2149495 to your computer and use it in GitHub Desktop.
httplib in python 2.7 set proxy
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
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.