I want to implement proxies in my python project with selenium. I got a list of proxies from a website and stored them in a list. Now how can I use a for loop to loop through each proxy and go to a website.
import requests
from lxml.html import fromstring
from itertools import cycle
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
def get_proxies():
url = 'https://free-proxy-list.net/'
response = requests.get(url)
parser = fromstring(response.text)
proxies = set()
for i in parser.xpath('//tbody/tr')[:10]:
if i.xpath('.//td[7][contains(text(),"yes")]'):
proxy = ":".join([i.xpath('.//td[1]/text()')[0], i.xpath('.//td[2]/text()')[0]])
proxies.add(proxy)
return proxies
proxies = get_proxies()
proxy_pool = cycle(proxies)