A simple and beautiful blog
Requests 是Python的第三方库,用来处理HTTP请求
1
$ pip install requests
1234567891011121314151617181920
# 引用requests类import requestsulr = "xxx"params = { "xx":"xxx",}headers={"User-Agent":"xxx"}# 发送get请求response = requests.get(url=url,params=param,headers=headers)# 查看请求头response.requests.headers# 获取请求结果response.text # 文本格式response.json() # json格式# 关掉请求response.close()
Seraching...