fei_hsueh
fei_hsueh

Reputation: 171

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)

But if i use it to open a 'https' website, it does not use proxies.How to fix it?

Upvotes: 0

Views: 87

Answers (1)

xiº
xiº

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

Related Questions