I want to install a couple of python packages which use easy_install. They use the urrlib2 module in their setup script. I tried using the company proxy to let easy_install download the required packages. So to test the proxy conn I tried the following code. I dont need to supply any credentials for proxy in IE.
proxy = urllib2.ProxyHandler({"http":"http://mycompanyproxy-as-in-IE:8080"})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
site = urllib2.urlopen("http://google.com")
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\urllib2.py", line 126, in
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 406, in
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 519, in
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 444, in
return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 378, in
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 527, in
raise HTTPError(req.get_full_url(), code, msg
urllib2.HTTPError: HTTP Error 407: AuthorizedOnly
Is it a problem with my code? or is the proxy not allowing a connection from the python process?. I can install R packages by setting the proxy.