get请求
response=requests.get(url=url,params=params,headers=headers)
不带参数:
response 对象其他重要属性
import requests
url='https://www.sogou.com/'
response=requests.get(url=url)
#二进制(byte)类型的页面数据
print(response.content)
# 返回一个响应状态码
print(response.status_code)
# 200
# 返回响应头信息--字典的形式
print(response.headers)
# {'Server': 'nginx', 'Date': 'Tue, 19 Mar 2019 07:31:40 GMT', 'Content-Type': 'text/html; charset=UTF-8',
# 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Accept-Encoding'