request = urllib2.Request(url)
ip_list=['119.6.136.122','114.106.77.14']
proxy_support = urllib2.ProxyHandler({'http':random.choice(ip_list)})
opener = urllib2.build_opener(proxy_support)
request.add_header('User-Agent','Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36')
urllib2.install_opener(opener)
response = urllib2.urlopen(request,timeout=30)
downloadFileData = response.read()
网友评论