urllib2 not support proxy on SSL connection?

itay_k itayyy at gmail.com
Tue May 2 23:22:24 CEST 2006


Hi,

I am running the following simple code (just open connection to some
https page with proxy):

proxy= '666.179.227.666:80'
proxy=urllib2.ProxyHandler({"https":'https://'+proxy})
opener = urllib2.build_opener(proxy)
request = urllib2.Request('https://somehttpspage....')
response = opener.open(request)

And I get this error:
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python24\lib\urllib2.py", line 358, in open
    response = self._open(req, data)
  File "C:\Python24\lib\urllib2.py", line 376, in _open
    '_open', req)
  File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "C:\Python24\lib\urllib2.py", line 1029, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "C:\Python24\lib\urllib2.py", line 996, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (1, 'error:140770FC:SSL
routines:SSL23_GET_SERV
ER_HELLO:unknown protocol')>

Is it possible that urllib2 doesnt support for proxy over https
connections?

Thanks alot,
Itay.




More information about the Python-list mailing list