I hope I find you well today.
Background Information: Today I was coding a program and wanted to add proxy support. So far I have managed to connect using Localhost. However I want to add support for proxies that have a username and password (Format is IP Address:Port:Username:Password) in order to make as many accounts as possible. So far the code I have used is:
from selenium import webdriver
PROXY_HOST = "107.178.214.243"
PROXY_PORT = "3128"
USERNAME = "test"
PASSWORD = "test"
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", PROXY_HOST)
profile.set_preference("network.proxy.http_port", PROXY_PORT)
profile.set_preference("network.proxy.socks_username", USERNAME)
profile.set_preference("network.proxy.socks_password", PASSWORD)
profile.update_preferences()
# executable_path = define the path if u don't already have in the PATH
system variable.
browser = webdriver.Firefox(firefox_profile=profile)
browser.get('https://whatismyipaddress.com/')
browser.maximize_window()
Now this is only for 1 proxy and it isn't headless (I know). I wanted to see what happened before I made it headless.
What Happens: It opens the Firefox browser just fine and goes to the site as well. However it doesn't actually use the proxy. It just uses my localhost.
What I need: I need it to use the proxy. Also would like it to be able to pick up proxies from a text file and use them