python伪装浏览器爬虫

待完善

import urllib2,urllib,cookielib

urllib.getproxies_registry=lambda:{}


request=urllib2.Request("http://tuan.qunar.com/hotel/kunming_7133?in_track=home_tuan_content&list=rexiaojingxuan")
request.add_header("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6")
html_tr=urllib2.urlopen(request)
html_tr=html_tr.read()
print html_tr

 

posted @ 2016-04-11 21:26  小星星☆  阅读(927)  评论(0编辑  收藏  举报