urllib.error.URLError: <urlopen error [WinError 10061] 由于目标计算机积极拒绝,无法连接。

来源:13-4 VSCode中调试代码

To树

2018-05-21

用的是winodws操作python 爬取网页

urllib.error.URLError: <urlopen error [WinError 10061] 由于目标计算机积极拒绝,无法连接。

写回答

2回答

7七月

2018-05-23

你地址写错了吧?

0
1
To树
Traceback (most recent call last): File "D:\Python3\lib\urllib\request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "D:\Python3\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "D:\Python3\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "D:\Python3\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "D:\Python3\lib\http\client.py", line 1026, in _send_output self.send(msg) File "D:\Python3\lib\http\client.py", line 964, in send self.connect() File "D:\Python3\lib\http\client.py", line 1392, in connect super().connect() File "D:\Python3\lib\http\client.py", line 936, in connect (self.host,self.port), self.timeout, self.source_address) File "D:\Python3\lib\socket.py", line 724, in create_connection raise err File "D:\Python3\lib\socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 老师,这问题我是暂时无头绪,网上说是被拦截或是端口有问题。
2018-05-23
共1条回复

鹿宝宝教你编程

2018-05-21

你把网页地址直接放浏览器里看看能不能访问啊

估计是因为没有带cookie 没有User-Ageint 之类的参数吧,或者网页需要登录啥的

0
2
瓦力博客
回复
To树
我也遇到该问题了,请问现在解决了吗?
2019-09-16
共2条回复

Python3.8系统入门+进阶 (程序员必备第二语言)

语法精讲/配套练习+思考题/原生爬虫实战

14866 学习 · 4500 问题

查看课程