Scrapy HtmlXPathSelector from string

I have an html response to a string. I am trying to make an HtmlXPathSelector from it, so that I can use xpaths on it. But it shows

TypeError: cannot create weak reference to 'str' obj 

Any idea how to convert the string to a response object that accepts an HtmlXPathSelector?

+4
source share
1 answer
 hxs = HtmlXPathSelector(text="my html") 
+15
source

Source: https://habr.com/ru/post/1390094/


All Articles