python爬虫-urllib2库的有一些高级用法,python-urllib2,import urlli
python爬虫-urllib2库的有一些高级用法,python-urllib2,import urlli
import urllibimport urllib2url = 'www.abc.com'form = {"name": '1234', "password": '4321'}data = urllib.urlencode(form) # 将字典以url形式编码header = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)', # 浏览器头 'Referer': 'http://www.abc.com' # 反盗链 }request = urllib2.Request(url, data, header)response = urllib2.urlopen(request)print response.read()
评论关闭