urllib2.URLError:<urlopen error =“”[errno =“”111] =“”connection =“”rejected =“”>

时间:2016-10-30 20:04:55

标签: python-2.7 urllib2

我正在尝试使用Expected Condition连接到http://localhost:1438/~cs1xx/1x/007.php。但我得到连接拒绝错误。任何人都可以帮助我吗?

以下是我到目前为止所做的细节和细节:

urllib2.urlopen

这里php_test是http://localhost:1438/~cs1xx/1x/007.php。我可以从浏览器访问此站点。我也可以使用:

ping这个
Traceback (most recent call last):
  File "main.py", line 472, in <module>
    php_data = urllib2.urlopen(php_test)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>

编辑:

Python代码(仅相关部分)

c$ nmap -p 1438 localhost

 Starting Nmap 6.40 ( http://nmap.org ) at 2016-10-30 12:52 PDT
 Nmap scan report for localhost (127.0.0.1)
 Host is up (0.00016s latency).
 Other addresses for localhost (not scanned): 127.0.0.1
 PORT     STATE  SERVICE
 1438/tcp closed eicon-server

 Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds

0 个答案:

没有答案