python爬虫-Response对象的属性

python爬虫-Response对象


r=requests.get("http://www.baidu.com/")

属性

r.status_code

http请求的返回状态,200表示连接成功,404表示连接失败

r.text

http响应内容的字符串形式,url对应的页面内容

r.encoding

从HTTP header中猜测的响应内容编码方式

r.apparent_encoding

从内容分析出的响应内容的编码方式(备选编码方式)

r.content

HTTP响应内容的二进制形式

r.headers

http响应内容的头部内容

原文地址:https://www.cnblogs.com/hjw1/p/8271422.html