lxml.html. Error reading file; Failed to load external entity

故事扮演 提交于 2019-11-30 22:40:42

SSL/TLS is not supported by libxml2. Use Python's urllib2 instead.

If you try any url with http://<blah>.<blah> you wont have trouble but https is not supported here. There are redirection issues also.

Try

from urllib2 import urlopen
import lxml.html
tree = lxml.html.parse(urlopen('https://google.com'))

For more information refer this


Solution

Well there are workaround. Try selenium and if you dont want a UI then run selenium in headless mode. Works fine i tried it myself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!