「PYTHON」-- 爬虫 requests

Response对象

转自 reponse


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响应内容的头部内容

猜你喜欢

转载自blog.csdn.net/qq_35269302/article/details/81156917