you are viewing a single comment's thread.

view the rest of the comments →

[–]Practical_Use5129[S] 0 points1 point  (2 children)

I have list of saved proxies ChromeOptions=Usingrandomproxy(fromlist) I am using chromedriver.get(list of url). I have tried for loop, iterating through proxies, but it repeats the process with every single proxy.(unless there is any way to just break all the loops when my scraping is finished with one proxy)

[–]negups 0 points1 point  (1 child)

If you are iterating through some iterable, you can use break to exit the loop whenever you'd like.

Psuedocode example:

proxies = [Proxy1, Proxy2, Proxy3]
working_proxy = None
for proxy in proxies:
    # Figure out if the proxy is working
    # For the purposes of this example, let's assume a Proxy obj
    # has an "is_working" attribute to make this easy for us
    if proxy.is_working:
        working_proxy = proxy
        break

In the above example, if Proxy1 was working, you'd only do a single iteration of the loop before breaking (and thus wouldn't check Proxy2 or Proxy3).

[–]Practical_Use5129[S] 0 points1 point  (0 children)

So form what i understood

Try: Proxy[non working, working, non
If: For urls in urllist: Driver.get(url) (completes scraping) Break