IPV6 Proxy with python

zcrusher

Newbie
Joined
Feb 8, 2024
Messages
7
Reaction score
3
Hello everyone, I need to connect to an IPV6 proxy with Python, but I couldn't perform the username and password authentication.


my_ipv6_proxy = "XXX"
# FirefoxOptions nesnesini oluştur
options = webdriver.FirefoxOptions()
# Proxy ayarlarını options'a ekle
options.add_argument(f"--proxy-server=socks5://{my_ipv6_proxy}")
# Proxy yetkilendirme bilgilerini options'a ekle (eğer gerekiyorsa)
options.add_argument("--proxy-username=XXX")
options.add_argument("--proxy-password=XXX")
# WebDriver'ı başlat
driver = webdriver.Firefox(options=options)
driver.get("x.com")
What is wrong with it?"
 
I'm not sure if adding these command line arguments does anything. I don't see them in --help, at least.
>stackoverflow.com SLASH questions SLASH 38304253 SLASH how-to-set-proxy-authentication-user-password-using-python-selenium

This is what worked for me for ipv4. It should be the same for ipv6.
 
You can use seleniumwire for this. There is a detailed and easy document, but I leave an example.

https://pypi.org/project/selenium-wire/

Python:
from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options

proxy = ""

options = Options()
#...

proxy_options = {
        'proxy': {
            'http': 'http://' + proxy,
            'https': 'https://' + proxy,
            'no_proxy': 'localhost,127.0.0.1'
        }
}

driver = webdriver.Chrome(options=options, seleniumwire_options=proxy_options)
driver.get("https://www.myip.ru/")
 
Back
Top