关于Python爬虫 403的错误
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Python爬虫 403的错误相关的知识,希望对你有一定的参考价值。
错误提示:
Traceback (most recent call last):
File "C:\Users\admin\Desktop\new1.py", line 7, in <module>
response=urllib.request.urlopen(url,timeout=10)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 156, in urlopen
return opener.open(url, data, timeout)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 469, in open
response = self._open(req, data)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 487, in _open
'_open', req)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 447, in _call_chain
result = func(*args)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 1274, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "D:\Program Files\Python 3.3.5\lib\urllib\request.py", line 1253, in do_open
r = h.getresponse()
File "D:\Program Files\Python 3.3.5\lib\http\client.py", line 1147, in getresponse
response.begin()
File "D:\Program Files\Python 3.3.5\lib\http\client.py", line 358, in begin
version, status, reason = self._read_status()
File "D:\Program Files\Python 3.3.5\lib\http\client.py", line 320, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "D:\Program Files\Python 3.3.5\lib\socket.py", line 297, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。
添加了Header
什么618爬虫代理服务器
其实都是差不多的,可能价格方面有不同,还有有的节点可能不一样
你可以对比一下,选个最适合自己的 参考技术B 贴出代码可以帮看一下
关于一些python爬虫示例代码
关于一些python爬虫示例代码
https://github.com/shengqiangzhang/examples-of-web-crawlers
提示:隔离区可通过gitee传送
参考:https://www.zhangshengrong.com/p/2EaE06do1M/
以上是关于关于Python爬虫 403的错误的主要内容,如果未能解决你的问题,请参考以下文章
Python爬虫报错:"HTTP Error 403: Forbidden"