Reputation: 171
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
opener=urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
But if i use it to open a 'https' website, it does not use proxies.How to fix it?
Upvotes: 0
Views: 87
Reputation: 4687
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
You only provided proxy for http
.
For sites with https
you need separate proxy.
urllib.request.ProxyHandler({'http':random.choice(iplist), 'https': "https://host:port'})
Upvotes: 1