can httplib.HTTPConnection use proxy?

adam adam_goucher at hotmail.com
Thu Mar 16 09:46:10 EST 2006


>>> import httplib
>>> h = httplib.HTTPConnection("www.google.ca")
>>> h.connect()
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\httplib.py", line 627, in connect
    raise socket.error, msg
error: (10061, 'Connection refused')
>>> h2 = httplib.HTTPConnection("my.proxy.host", "my.proxy.port")
>>> h2.connect()
>>> h2.request("GET", "http://www.google.ca")
>>> resp = h2.getresponse()
>>> page = resp.read()




More information about the Python-list mailing list