I have some difficulties with module requests
.
It takes argument proxies
.
I saw in this question description on this module and I've understood, that it takes only one proxy from the dict.
But if one proxy is blocked?
I want to use dictionary with a lot of proxies, if one proxy is blocked, I want take another proxy, but how can I do that?
Asked
Active
Viewed 108 times
0

Community
- 1
- 1

Petr Petrov
- 4,090
- 10
- 31
- 68
-
You are going to quickly run out of proxies, you may find using selenium with PhantomJs is a better option – Padraic Cunningham Oct 20 '16 at 14:32
2 Answers
0
Define list_of_proxies = [{proxy_0}, {proxy_1}, ...]
and then paste them as needed r = requests.get(url, headers=headers, proxies = list_of_proxies[i])
where you set i
according to the logic of your code.

Nurjan
- 5,889
- 5
- 34
- 54
0
Define list of proxies
and then use random.choice(list)
function to call random choice from list and use in your code.
Thank you.

user7365756
- 11
- 3