The lesson on 'Web scraping using Python: requests and lxml
Overview' has an error in the follow code:
"Traversing elements in a page with lxml"
import requests
import lxml.html
response = requests.get('http://www.un.org/en/sc/documents/resolutions/2016.shtml')
tree = lxml.html.HTML(response.text)
this last line ("tree = lxml.html.HTML(response.text)") doesn't work. I've searched for quite a long time to troubleshoot, but it seems the explanation below has the answer, fortunately:
"This code begins by building a tree of Elements from the HTML using lxml.html.fromstring(some_html). "
Thought I'd point this out to you people, because it's was really bugging me, and since I love what you are doing, I'd better help out a bit.
Cheers, Laurens