标签:div proc uil bsp sso imp import com blog
#coding:utf8 __author__ = ‘wang‘ import urllib2 import cookielib url = "http://www.baidu.com"; response = urllib2.urlopen(url) print(len(response.read())); request = urllib2.Request(url) request.add_header(‘user-agent‘,‘Mozilla/5.0‘) response1 = urllib2.urlopen(request) print len(response1.read()) cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) response2 = urllib2.urlopen(url) print cj print len(response2.read())
标签:div proc uil bsp sso imp import com blog
原文地址:http://www.cnblogs.com/php-linux/p/6028902.html