requests-html: Getting a http.client.BadStatusLine error after calling render()
I basically just followed the example in the documentation:
session = HTMLSession()
r = session.get('https://python.org/')
After running this
r.html.render()
I’m getting this error
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.6/urllib/request.py", line 526, in open response = self._open(req, data) File "/usr/lib/python3.6/urllib/request.py", line 544, in _open '_open', req) File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/usr/lib/python3.6/urllib/request.py", line 1346, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.6/urllib/request.py", line 1321, in do_open r = h.getresponse() File "/usr/lib/python3.6/http/client.py", line 1346, in getresponse response.begin() File "/usr/lib/python3.6/http/client.py", line 307, in begin version, status, reason = self._read_status() File "/usr/lib/python3.6/http/client.py", line 289, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: GET /json/version HTTP/1.1
r.html.html prints the entire DOM but I’m not sure why I would get a http.client.BadStatusLine error.
Is this the right way to do this? or am I missing something here?
I’m currently using Python 3.6.9
Thanks
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20
Are you using it on Windows Subsystem for Linux? I didn’t get this error while running it natively on Windows
I got it working on WSL. These are the steps of followed:
Same issue on centos/python3.7