proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
opener=urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
但是,如果我用它打开一个' https'网站,它不使用proxies.How修复它?
答案 0 :(得分:1)
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
您只为http
提供了代理。
对于https
的网站,您需要单独的代理。
urllib.request.ProxyHandler({'http':random.choice(iplist), 'https': "https://host:port'})