python使用代理
import urllib.request
import random
url = 'https://www.kuaidaili.com/free/intr/'
iplist = ['117.141.155.243:53281','58.249.55.222:9797']
proxy_support = urllib.request.ProxyHandler({'http':random.choice(iplist)})
opener = urllib.request.build_opener(proxy_support)
opener.addheaders = [('User-Agent','Mozilla/5.0 (X11; Linux x86_64) ')]
urllib.request.install_opener(opener)
response = urllib.request.urlopen(url)
html = response.read().decode('utf-8')
print(html)