AttributeError: 'HTMLSession' object has no attribute 'html'

AttributeError: 'HTMLSession' object has no attribute 'html'

您好,我正在进入 requests_html 并尝试渲染 Javascript,但它似乎无法正确处理。非常简单的脚本,我添加了一个睡眠,看看它是否会渲染,但仍然是同样的问题,这是代码。

from requests_html import HTMLSession

requests = HTMLSession()

requests.get('https://google.com')
requests.html.render(sleep=2)

我不认为它是这样工作的,我只有在将响应保存到变量时才能让它工作:

from requests_html import HTMLSession

requests = HTMLSession()

resp = requests.get('https://www.google.com')
resp.html.render(sleep=2)

print(resp.text)