如何使用proxie通过urllib打开'https'网站?
How to use proxie to open 'https' website by urllib?
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
opener=urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
但是如果我用它打开一个'https'网站,它不会用proxies.How修复它?
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
您只为 http
提供了代理。
对于具有 https
的站点,您需要单独的代理。
urllib.request.ProxyHandler({'http':random.choice(iplist), 'https': "https://host:port'})
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
opener=urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
但是如果我用它打开一个'https'网站,它不会用proxies.How修复它?
proxy_support=urllib.request.ProxyHandler({'http':random.choice(iplist)})
您只为 http
提供了代理。
对于具有 https
的站点,您需要单独的代理。
urllib.request.ProxyHandler({'http':random.choice(iplist), 'https': "https://host:port'})