我正在處理一些返回HTML
字符串(my_html
)的代碼。我想看看如何在瀏覽器中使用https://doc.scrapy.org/en/latest/topics/debug.html#open-in-browser。爲此,我嘗試創建一個響應對象,其主體設置爲'my_html
'。我已經嘗試了一堆東西,包括:Scrapy - 如何將HTML字符串加載到open_in_browser函數
new_response = TextResponse(body=my_html)
open_in_browser(new_response)
基於響應類(
https://doc.scrapy.org/en/latest/topics/request-response.html#response-objects)
。我得到︰
new_response = TextResponse(body=my_html)
File "c:\scrapy\http\response\text.py", line 27, in __init__
super(TextResponse, self).__init__(*args, **kwargs)
TypeError: __init__() takes at least 2 arguments (2 given)
我該如何得到這個工作?
* ...至少需要2個參數(2給出)* WTF? – linusg