Reputation: 4368
I have done proxy settings using CNTLM and also have a script(google.py) to check proxy setting are working or not
import urllib.request
proxy_support = urllib.request.ProxyHandler({"http":"http://localhost:3128"})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
html = urllib.request.urlopen("http://www.google.com").read()
print(html)
when i run the script I'm getting following errors
C:\Users\asj5cob\Desktop>py -3.4 google.py
Traceback (most recent call last):
File "google.py", line 5, in <module>
html = urllib.request.urlopen("http://www.google.com").read()
File "C:\Python34\lib\urllib\request.py", line 161, in urlopen
return opener.open(url, data, timeout)
File "C:\Python34\lib\urllib\request.py", line 470, in open
response = meth(req, response)
File "C:\Python34\lib\urllib\request.py", line 580, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python34\lib\urllib\request.py", line 508, in error
return self._call_chain(*args)
File "C:\Python34\lib\urllib\request.py", line 442, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 588, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 502: Parent proxy unreacheable
Upvotes: 1
Views: 11342
Reputation: 43
Did you start CNTLM by executing in your administrator cmd window?
net start cntlm
Upvotes: 1