B
Bloke
I want to connect to a https server through an authenticating proxy
like this:
import urllib2
proxy_info = {
'user' : 'me',
'pass' : 'password',
'host' : 'mycompany.com.au',
'port' : 8008 }
# build a new opener that uses a proxy requiring authorization
proxy_support = urllib2.ProxyHandler({"https":"https://%(user)s:%
(pass)s@%(host)s:%(port)d" % proxy_info})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
# install it
urllib2.install_opener(opener)
# use it
f = urllib2.urlopen('https://www.securewebsite.com.au')
print f.headers
print f.read()
f.close()
If I modify the 'https' to 'http' it works fine. But in https mode it
returns:
URLError: <urlopen error (8, 'EOF occurred in violation of protocol')>
The site works fine if I do not go through the proxy, so it appears the
proxy is not returning an EOF. I been searching for an answer, and
found many other sites where people have had the same problem. Some
have suggested m2crypto.
Is there a work around using the standard 2.4.1 installation?
like this:
import urllib2
proxy_info = {
'user' : 'me',
'pass' : 'password',
'host' : 'mycompany.com.au',
'port' : 8008 }
# build a new opener that uses a proxy requiring authorization
proxy_support = urllib2.ProxyHandler({"https":"https://%(user)s:%
(pass)s@%(host)s:%(port)d" % proxy_info})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
# install it
urllib2.install_opener(opener)
# use it
f = urllib2.urlopen('https://www.securewebsite.com.au')
print f.headers
print f.read()
f.close()
If I modify the 'https' to 'http' it works fine. But in https mode it
returns:
URLError: <urlopen error (8, 'EOF occurred in violation of protocol')>
The site works fine if I do not go through the proxy, so it appears the
proxy is not returning an EOF. I been searching for an answer, and
found many other sites where people have had the same problem. Some
have suggested m2crypto.
Is there a work around using the standard 2.4.1 installation?