<filename>AllSpiders/00_Spider/14_requests.py
# -*- coding:utf-8 -*-
import requests
import urllib

wd = {'q': '长城'}

headers = {"User-Agent": "Mozilla/5.0"}

# params 接收一个字典或者字符串的查询参数，字典类型自动转换为url编码，不需要urlencode()
response = requests.get("https://www.google.com/search?", params=wd, headers=headers)

# 查看响应内容，response.text 返回的是Unicode格式的数据
# print response.text

# 查看响应内容，response.content返回的字节流数据
print response.content

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

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

# 查看响应码
print response.status_code