python爬虫错误:http.client.HTTPException: got more than 100 headers的解决方法

Posted brucelong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python爬虫错误:http.client.HTTPException: got more than 100 headers的解决方法相关的知识,希望对你有一定的参考价值。

python爬虫错误:http.client.HTTPException: got more than 100 headers的解决方法

Traceback (most recent call last):
File "C:UsersJonariguezAppDataRoamingPythonPython36site-packagesurllib3connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:UsersJonariguezAppDataRoamingPythonPython36site-packagesurllib3connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "C:UsersJonariguezAppDataRoamingPythonPython36site-packagesurllib3connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "D:SoftwarePython3libhttpclient.py", line 1331, in getresponse
response.beg

错误
返回的请求头大多,超过了自定义的最大请求头个数

解决方法:
修改最大请求头个数即可。

python3

import http.client

http.client._MAXHEADERS = 1000

 

python2

import httplib

httplib._MAXHEADERS = 1000

 

以上是关于python爬虫错误:http.client.HTTPException: got more than 100 headers的解决方法的主要内容,如果未能解决你的问题,请参考以下文章

python爬虫-纠正MD5错误认知

python爬虫错误:http.client.HTTPException: got more than 100 headers的解决方法

python写了一个爬虫,内容储存到mongodb数据库,遇到一个错误不知怎么改,求大神帮忙

python爬虫优化和错误日志分析

python爬虫之细节小问题

python爬虫出现菱形问号乱码的解决方法