Re: can httplib.HTTPConnection use proxy?

2006-03-17 Thread robert
JuHui wrote:

> sorry, would you please give a sample code?
> I want to use HTTPConnection to get a html page content via a http
> proxy.
> thanks.
> 

-> adam

and maybe you just want plain GET/POST.  use urllib

 >>> url='http://www.google.ca'
 >>> urllib.FancyURLopener(proxies={'http':'http://vs:3128'}).open( url 
).read()
'Google

Re: can httplib.HTTPConnection use proxy?

2006-03-16 Thread adam
>>> import httplib
>>> h = httplib.HTTPConnection("www.google.ca")
>>> h.connect()
Traceback (most recent call last):
  File "", 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()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can httplib.HTTPConnection use proxy?

2006-03-16 Thread JuHui
sorry, would you please give a sample code?
I want to use HTTPConnection to get a html page content via a http
proxy.
thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can httplib.HTTPConnection use proxy?

2006-03-16 Thread robert
JuHui wrote:

> how to use httplib.HTTPConnection with http proxy?
> 

simply connect to the proxy? - and ask using the full url and original 
Host:  - for HTTPS do a CONNECT .

Robert
-- 
http://mail.python.org/mailman/listinfo/python-list


can httplib.HTTPConnection use proxy?

2006-03-16 Thread JuHui
how to use httplib.HTTPConnection with http proxy?

-- 
http://mail.python.org/mailman/listinfo/python-list


can httplib.HTTPConnection use proxy?

2006-03-16 Thread JuHui
how to use httplib.HTTPConnection with http proxy?

-- 
http://mail.python.org/mailman/listinfo/python-list