两个库的返回比较
import header
import random
import requests
import urllib2
from bs4 import BeautifulSoup
#----------------------------------------------------------------------
def url_info(url):
""""""
data = urllib2.Request(url,headers=header.get_header())
html_url = requests.get(url, timeout=random.randint(3,8))
print type(data.headers)
print html_url.encoding
print html_url.headers
soup = BeautifulSoup(html_url.content, 'html.parser')
#print soup
print soup.title.string
url_info('http://www.xxx.net')
resp = urllib2.urlopen('http://www.xxx.net')
print type(resp)
print resp.headers
print resp.info()