[英]AttributeError: 'Response' object has no attribute 'text'
page = requests.get(url)
tree = html.fromstring(page.text)
At line 2 I get:在第 2 行,我得到:
AttributeError: 'Response' object has no attribute 'text'
I have imported requests and installed requests.我已经导入了请求并安装了请求。 How do I debug this error?我如何调试这个错误? can anyone tell command to install lastest requests module?谁能告诉命令安装最新的请求模块?
You are using an ancient version of requests
, most likely because it came installed with Ubuntu Precise Pengolin (12.04LTS) .您使用的是旧版本的requests
,很可能是因为它是随Ubuntu Precise Pengolin (12.04LTS) 一起安装的。
You'll either have to refer to the version specific documentation or use a more recent version.您要么必须参考特定版本的文档,要么使用更新的版本。 requests
has changed drastically since the 0.x version days.自 0.x 版本以来, requests
发生了巨大变化。
For your old version, if you set response.encoding
, response.content
will contain a decoded Unicode value.对于旧版本,如果设置response.encoding
, response.content
将包含解码的 Unicode 值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.