以下两种方法均可以设置proxy
1 .
os.environ["http_proxy"] = 'http://host:port'
2
proxies = {'http': 'http://host:port'}resp = urllib.urlopen(url, proxies=proxies)content = resp.read()