kaliiiiiiiiii / Selenium-Profiles

undetected Selenium using chromedriver and emulation / device profiles
Other
255 stars 29 forks source link

Error on proxy in /src/selenium_profiles/scripts/profiles.py #46

Closed tnt2k closed 1 year ago

tnt2k commented 1 year ago
def proxy(self, proxy: str = None):
        """
        :param proxy: scheme://host:port => https://example.com:9000
        """
        supported_schemes = ["http", "https", "socks4", "socks5"]

        if proxy:
            scheme = proxy.split("://")
            check_cmd(scheme, supported_schemes)
            if "@" in proxy:
                raise ValueError("Proxies specified in options don't allow authentification")
            self.add_argument('--proxy-server=' + proxy)

The error may need to be corrected:

def proxy(self, proxy: str = None):
        """
        :param proxy: scheme://host:port => https://example.com:9000
        """
        supported_schemes = ["http", "https", "socks4", "socks5"]

        if proxy:
            scheme = proxy.split("://")[0]
            check_cmd(scheme, supported_schemes)
            if "@" in proxy:
                raise ValueError("Proxies specified in options don't allow authentification")
            self.add_argument('--proxy-server=' + proxy)

or

def proxy(self, proxy: str = None):
        """
        :param proxy: scheme://host:port => https://example.com:9000
        """
        supported_schemes = ["http", "https", "socks4", "socks5"]

        if proxy:
            scheme = proxy.split("://")
            check_cmd(scheme[0], supported_schemes)
            if "@" in proxy:
                raise ValueError("Proxies specified in options don't allow authentification")
            self.add_argument('--proxy-server=' + proxy)
kaliiiiiiiiii commented 1 year ago

Uhhh my bad:) I'll correct it in the next version. For now, just add a command-line proxy using --proxy-server=' + proxy or using auth_proxy, as auth is optional