I'm using requests
module in my script, and I want to understand the proxies
parameter in the get()
method. This answer has posted the following code to illustrate the usage of proxies
parameter:
http_proxy = "10.10.1.10:3128"
https_proxy = "10.10.1.11:1080"
ftp_proxy = "10.10.1.10:3128"
proxyDict = {"http":http_proxy, "https":https_proxy, "ftp":ftp_proxy }
r = requests.get(url, headers=headers, proxies=proxyDict)
Here are my questions:
Why are we passing more then one proxy to
get()
? How doesget()
use them? Does it try one by one?Given a proxy say,
a.b.c.d:port
, how would I know its protocol type? When you buy premium proxies from hidemyass.com, it sends proxies inip:port
format only and doesn't send the protocol type. So what should I pass torequests.get()
method?
I've these doubts because I don't know much about proxies in general and how they work. So it would be great if somebody explains this as well.