from selenium import webdriver
from selenium.common.exceptions import TimeoutException
import time
with open('proxy.txt', 'r') as file:
proxy_list = [a.strip() for a in file.readlines()]
for proxy in proxy_list:
service_args = [
'--proxy={}'.format(proxy),
'--proxy-type=http',
]
browser=webdriver.PhantomJS(service_args=service_args)
browser.set_page_load_timeout(20)
try:
print("TRY PROXY")
browser.get('http://check-host.net/ip')
print ("Loaded.Wait.")
except TimeoutException:
print("cant load")
browser.get_screenshot_as_file('/var/www/html/img/po.png')
browser.quit()