#!usr/bin/env python
#-*- coding:utf-8 -*-
"""
@author:Administrator
@file: request.py
@time: 2018/10/13
"""
import requests
# 请求百度网页
response = requests.get("https://www.baidu.com", data=None, timeout=10)
#打印出服务器响应的header信息
print("打印出服务器响应的header信息:",response.headers)
#打印出服务器响应的状态码
print("打印出服务器响应的状态码:",response.status_code)
#打印出响应信息
print("打印出响应信息:",response.text)
#以json格式打印出响应信息
#print(response.json())
print("打印出request",response.request)
print("打印出请求的cookie:",response.cookies)
print("判断请求是否ok:",response.ok)