Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import random
- from selenium.common.exceptions import TimeoutException
- from selenium import webdriver
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.firefox.options import Options
- from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
- from selenium.webdriver.common.proxy import Proxy, ProxyType
- import platform
- import requests
- import urllib.request
- import os
- def chrome_binary_path():
- os_sys = platform.system()
- if os_sys == "Windows":
- return r'{}\driver\chromedriver.exe'.format(os.getcwd())
- elif os_sys == 'Darwin':
- return '/usr/local/bin/chromedriver'
- username = 'lum-customer-hl_185d159c-zone-static-route_err-pass_dyn'
- password = 'io2z95j7jj2w'
- port = 22225
- session_id = random.random()
- super_proxy_url = ('http://%s-session-%s:%s@zproxy.lum-superproxy.io:%d' %
- (username, session_id, password, port))
- proxy_handler = urllib.request.ProxyHandler({
- 'http': super_proxy_url,
- 'https': super_proxy_url,
- })
- opener = urllib.request.build_opener(proxy_handler)
- proxy_details = opener.open('http://lumtest.com/myip.json').read()
- data = json.loads(proxy_details)
- PROXY = data['ip']+":"+"22225"
- options = webdriver.ChromeOptions()
- options.add_argument("--start-maximized")
- options.add_argument('--proxy-server=%s' % PROXY)
- driver = webdriver.Chrome(
- executable_path=chrome_binary_path(), options=options)
- driver.set_page_load_timeout(120)
- driver.get("https://whatismyipaddress.com/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement