Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Getting a http.client.BadStatusLine error after calling render() #395
Comments
Having the same issue |
Are you using it on Windows Subsystem for Linux? |
Same issue on centos/python3.7 |
same issue. I am running it on WSL python 3.7.
|
|
same issue. python 3.6.7 on WSL |
Has anyone solved this problem on centos/python3.6? |
Having this problem in Ubuntu 18.04 VPS as well! |
At first I thought it was something about macOS. Then WSL with Ubuntu. Then Ubuntu proper. But it wasn't them. What worked on macOS was to fix the versions tornado==4.5.3, and also notebook==5.7.8 (which allowed both HTMLSession and AsyncHTMLSession to work as intended under Jupyter). Haven't yet checked WSL and Ubuntu. Please check if this works for you on other combinations of OS and Python. |
Tried this on WSL Kali Linux, unfortunately didn't work. Still getting a very similar error to that of others in this thread: |
I could be wrong, but I think Additionally, I also noticed that the I tried running the same code a few times but it did not download the Chromium browser, however, I did notice a few processes were spawned with the name I may have a possible work around (this is not fully tested)
|
sagar1025, thanks for the tips. I just installed chromium-browser and it worked. I didn't have to copy it or make a soft link and, in fact, I don't even have a .pyppeteer folder in my home folder... but it is working. I just did sudo apt-get update and sudo apt-get install chromium-browser. Then went to my project, activated the venv and it's working. I'm able to get the rendered html. Was chromium supposed to be installed automatically or did I just miss that step in the requests-html setup process? |
@brendan98 According to doc, it will be installed automatically. For me, it isnt working on centos7 but working on macos |
I followed these steps, but I am still getting the same error. I am using Ubuntu WSL. |
I got it working on WSL. These are the steps of followed:
sudo apt-get update && apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
pip install pyppdf
import pyppdf.patch_pyppeteer |
So this was a dependency issue? |
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 ahttp.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