Since google did not find anything regarding error "http.client.HTTPException: got more than 100 headers", I created this question.
>>> import http.client as h
>>> conn = h.HTTPConnection("www.coursefinders.com")
>>> conn.request("HEAD","/")
>>> conn.getresponse();
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/http/client.py", line 1148, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 376, in begin
self.headers = self.msg = parse_headers(self.fp)
File "/usr/lib/python3.4/http/client.py", line 267, in parse_headers
raise HTTPException("got more than %d headers" % _MAXHEADERS)
http.client.HTTPException: got more than 100 headers
What does this exception mean and how should I properly handle this type of error? Site works OK in browser.
Here is a solution that doesn't involve changing library's py files:
import httplib # or http.client if you're on Python 3
httplib._MAXHEADERS = 1000
Just put that at the top of your code
change the value of "_MAXHEADERS" to 1000 or 10000 in C:\Python27\Lib\httplib.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With