urlopen错误[Errno 111]连接在一个非常简单的脚本中被拒绝

时间:2016-11-19 06:05:38

标签: python ssl https urllib2

我已经检查了代理设置是否已启用,重置winsock,卸载防火墙和防病毒,我仍然收到相同的错误消息,但如果我在Firefox或IE中键入url就可以了。谢谢你的帮助

这是脚本:

import urllib2
import ssl

gcontext = ssl._create_unverified_context()
url = 'https://192.168.1.1:8000/cgi-bin/login.html'
html = urllib2.urlopen(url=url,context=gcontext).read()    
print html

这是追溯:

File "get_url.py", line 6, in <module>
    f = urllib2.urlopen("https://192.168.1.1:8000/cgi-bin/login.html",context=gcontext, timeout=3000)
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 467, in error
    result = self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 654, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>

0 个答案:

没有答案