Demo entry 6732922

ave been contribute

   

Submitted by anonymous on Apr 16, 2018 at 09:58
Language: Python 3. Code size: 411 Bytes.

# 导入库
import requests
# 发起请求,获取响应
response = requests.get('http://www.baidu.com')

# 查看响应内容,content返回字节流数据
print(response.content.decode())

# 查看响应内容,text返回Unicode格式的数据
print(response.text)

# 查看完整url地址
print(response.url)

# 查看响应码
print(response.status_code)

# 查看响应头部字符编码
print(response.encoding)

# 发送到服务器的请求的头部
print(response.request.headers)

# 服务器返回给我们的响应头部
print(response.headers)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).