selenium-proxy-auth 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JiBao Proxy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: selenium-proxy-auth
3
+ Version: 0.1.0
4
+ Summary: Authenticated proxies for Selenium + Chrome without selenium-wire. Generates a proxy-auth extension on the fly.
5
+ Author-email: JiBao Proxy <support@jibaoproxy.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://jibaoproxy.com
8
+ Project-URL: Source, https://github.com/jibaoproxyofficial-pixel/selenium-proxy-auth
9
+ Keywords: selenium,proxy,proxy-authentication,chrome,web-scraping,browser-automation,residential-proxy
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Internet :: WWW/HTTP
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # selenium-proxy-auth
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
22
+ [![Python versions](https://img.shields.io/pypi/pyversions/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ Use an **authenticated (user:pass) proxy with Selenium + Chrome** — without selenium-wire. It generates a tiny proxy-auth extension on the fly and loads it, so Chrome never shows the native auth popup that Selenium can't click.
26
+
27
+ ```bash
28
+ pip install selenium-proxy-auth
29
+ ```
30
+
31
+ ## The problem
32
+
33
+ Chrome's `--proxy-server` flag has nowhere to put a username and password. So with an authenticated proxy, Chrome throws a **native auth dialog** — which Selenium can't interact with — and every request hangs or 407s:
34
+
35
+ ```python
36
+ # ❌ no place for credentials; Chrome shows a popup Selenium can't dismiss
37
+ opts.add_argument("--proxy-server=http://user:pass@gw.example.com:913")
38
+ ```
39
+
40
+ The reliable fix is a small extension that sets `chrome.proxy` and answers `onAuthRequired` with your credentials. This package builds and loads it for you.
41
+
42
+ ## Usage
43
+
44
+ ```python
45
+ import shutil
46
+ from selenium import webdriver
47
+ from selenium_proxy_auth import add_proxy
48
+
49
+ opts = webdriver.ChromeOptions()
50
+ opts.add_argument("--headless=new")
51
+
52
+ ext = add_proxy(opts, "http://USERNAME:PASSWORD@us.jibaoproxy.com:913")
53
+
54
+ driver = webdriver.Chrome(options=opts)
55
+ try:
56
+ driver.get("https://httpbin.org/ip")
57
+ print(driver.find_element("tag name", "body").text)
58
+ finally:
59
+ driver.quit()
60
+ shutil.rmtree(ext, ignore_errors=True) # clean up the generated extension
61
+ ```
62
+
63
+ `add_proxy` returns the path to the generated extension directory so you can delete it afterwards. The extension contains your credentials in plaintext — it's written to a temp dir; don't commit it.
64
+
65
+ ## How it works
66
+
67
+ - Manifest V3 extension with the `proxy`, `webRequest`, and `webRequestAuthProvider` permissions.
68
+ - A background service worker sets `chrome.proxy.settings` to your `host:port` and returns `authCredentials` from `onAuthRequired`.
69
+ - Loaded via `--load-extension`, so it works in headless `--headless=new`. (Old `--headless` does not load extensions; use `--headless=new`.)
70
+
71
+ Need just the files (e.g. for undetected-chromedriver)? Use `make_proxy_extension(url)` to get the directory and load it yourself.
72
+
73
+ ## Rotating IPs
74
+
75
+ A rotating residential gateway hands out a new exit IP per connection from one URL — point `add_proxy` at the gateway and each fresh `webdriver.Chrome` gets a different IP. If you're still getting blocked after authenticating, the exit IP is the issue: datacenter ranges get scored as bots by ASN and [TLS fingerprint](https://jibaoproxy.com/blog/ja3-tls-fingerprint-detection-explained.html) before the page loads. We build [JiBao Proxy](https://jibaoproxy.com) for clean residential exits — 72M+ IPs, 200+ countries, sticky sessions. Works with any provider, though.
76
+
77
+ ## Related
78
+
79
+ - [Selenium & Playwright proxy authentication, explained](https://jibaoproxy.com/blog/selenium-playwright-proxy-authentication.html)
80
+ - [AdsPower / Multilogin proxy setup](https://jibaoproxy.com/blog/adspower-multilogin-proxy-setup.html)
81
+ - [Bypassing DataDome & PerimeterX in 2026](https://jibaoproxy.com/blog/datadome-perimeterx-bypass-2026.html)
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,67 @@
1
+ # selenium-proxy-auth
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Use an **authenticated (user:pass) proxy with Selenium + Chrome** — without selenium-wire. It generates a tiny proxy-auth extension on the fly and loads it, so Chrome never shows the native auth popup that Selenium can't click.
8
+
9
+ ```bash
10
+ pip install selenium-proxy-auth
11
+ ```
12
+
13
+ ## The problem
14
+
15
+ Chrome's `--proxy-server` flag has nowhere to put a username and password. So with an authenticated proxy, Chrome throws a **native auth dialog** — which Selenium can't interact with — and every request hangs or 407s:
16
+
17
+ ```python
18
+ # ❌ no place for credentials; Chrome shows a popup Selenium can't dismiss
19
+ opts.add_argument("--proxy-server=http://user:pass@gw.example.com:913")
20
+ ```
21
+
22
+ The reliable fix is a small extension that sets `chrome.proxy` and answers `onAuthRequired` with your credentials. This package builds and loads it for you.
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ import shutil
28
+ from selenium import webdriver
29
+ from selenium_proxy_auth import add_proxy
30
+
31
+ opts = webdriver.ChromeOptions()
32
+ opts.add_argument("--headless=new")
33
+
34
+ ext = add_proxy(opts, "http://USERNAME:PASSWORD@us.jibaoproxy.com:913")
35
+
36
+ driver = webdriver.Chrome(options=opts)
37
+ try:
38
+ driver.get("https://httpbin.org/ip")
39
+ print(driver.find_element("tag name", "body").text)
40
+ finally:
41
+ driver.quit()
42
+ shutil.rmtree(ext, ignore_errors=True) # clean up the generated extension
43
+ ```
44
+
45
+ `add_proxy` returns the path to the generated extension directory so you can delete it afterwards. The extension contains your credentials in plaintext — it's written to a temp dir; don't commit it.
46
+
47
+ ## How it works
48
+
49
+ - Manifest V3 extension with the `proxy`, `webRequest`, and `webRequestAuthProvider` permissions.
50
+ - A background service worker sets `chrome.proxy.settings` to your `host:port` and returns `authCredentials` from `onAuthRequired`.
51
+ - Loaded via `--load-extension`, so it works in headless `--headless=new`. (Old `--headless` does not load extensions; use `--headless=new`.)
52
+
53
+ Need just the files (e.g. for undetected-chromedriver)? Use `make_proxy_extension(url)` to get the directory and load it yourself.
54
+
55
+ ## Rotating IPs
56
+
57
+ A rotating residential gateway hands out a new exit IP per connection from one URL — point `add_proxy` at the gateway and each fresh `webdriver.Chrome` gets a different IP. If you're still getting blocked after authenticating, the exit IP is the issue: datacenter ranges get scored as bots by ASN and [TLS fingerprint](https://jibaoproxy.com/blog/ja3-tls-fingerprint-detection-explained.html) before the page loads. We build [JiBao Proxy](https://jibaoproxy.com) for clean residential exits — 72M+ IPs, 200+ countries, sticky sessions. Works with any provider, though.
58
+
59
+ ## Related
60
+
61
+ - [Selenium & Playwright proxy authentication, explained](https://jibaoproxy.com/blog/selenium-playwright-proxy-authentication.html)
62
+ - [AdsPower / Multilogin proxy setup](https://jibaoproxy.com/blog/adspower-multilogin-proxy-setup.html)
63
+ - [Bypassing DataDome & PerimeterX in 2026](https://jibaoproxy.com/blog/datadome-perimeterx-bypass-2026.html)
64
+
65
+ ## License
66
+
67
+ MIT
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "selenium-proxy-auth"
7
+ version = "0.1.0"
8
+ description = "Authenticated proxies for Selenium + Chrome without selenium-wire. Generates a proxy-auth extension on the fly."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "JiBao Proxy", email = "support@jibaoproxy.com" }]
13
+ keywords = ["selenium", "proxy", "proxy-authentication", "chrome", "web-scraping", "browser-automation", "residential-proxy"]
14
+ classifiers = [
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: Internet :: WWW/HTTP",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://jibaoproxy.com"
23
+ Source = "https://github.com/jibaoproxyofficial-pixel/selenium-proxy-auth"
24
+
25
+ [tool.setuptools]
26
+ packages = ["selenium_proxy_auth"]
@@ -0,0 +1,4 @@
1
+ from .extension import add_proxy, make_proxy_extension
2
+
3
+ __all__ = ["add_proxy", "make_proxy_extension"]
4
+ __version__ = "0.1.0"
@@ -0,0 +1,80 @@
1
+ """Generate a Chrome extension that configures an authenticated proxy for Selenium.
2
+
3
+ Selenium can't pass proxy credentials to Chrome directly — ``--proxy-server`` has
4
+ no place for a username/password, so an authenticated proxy pops a native auth
5
+ dialog that Selenium can't dismiss. The standard fix is a tiny extension that sets
6
+ ``chrome.proxy`` and answers ``onAuthRequired`` with your credentials. This builds
7
+ that extension on the fly, no selenium-wire dependency.
8
+ """
9
+ import os
10
+ import tempfile
11
+ from urllib.parse import unquote, urlparse
12
+
13
+ __all__ = ["make_proxy_extension", "add_proxy"]
14
+
15
+ _MANIFEST = """{
16
+ "name": "Selenium Proxy Auth",
17
+ "version": "1.0.0",
18
+ "manifest_version": 3,
19
+ "permissions": ["proxy", "webRequest", "webRequestAuthProvider"],
20
+ "host_permissions": ["<all_urls>"],
21
+ "background": { "service_worker": "background.js" },
22
+ "minimum_chrome_version": "108"
23
+ }"""
24
+
25
+ _BACKGROUND = """var config = {
26
+ mode: "fixed_servers",
27
+ rules: {
28
+ singleProxy: { scheme: "%(scheme)s", host: "%(host)s", port: %(port)d },
29
+ bypassList: ["localhost", "127.0.0.1"]
30
+ }
31
+ };
32
+ chrome.proxy.settings.set({ value: config, scope: "regular" }, function () {});
33
+ chrome.webRequest.onAuthRequired.addListener(
34
+ function () {
35
+ return { authCredentials: { username: "%(user)s", password: "%(password)s" } };
36
+ },
37
+ { urls: ["<all_urls>"] },
38
+ ["blocking"]
39
+ );
40
+ """
41
+
42
+
43
+ def make_proxy_extension(proxy_url, directory=None):
44
+ """Write an unpacked Chrome extension for ``proxy_url`` and return its path.
45
+
46
+ ``proxy_url`` is an ordinary ``scheme://user:pass@host:port`` URL.
47
+ Caller is responsible for deleting the directory when done.
48
+ """
49
+ p = urlparse(proxy_url)
50
+ if not p.hostname or not p.port:
51
+ raise ValueError(f"Proxy URL needs host and port: {proxy_url!r}")
52
+ fields = {
53
+ "scheme": (p.scheme or "http").replace("https", "http"),
54
+ "host": p.hostname,
55
+ "port": int(p.port),
56
+ "user": unquote(p.username or ""),
57
+ "password": unquote(p.password or ""),
58
+ }
59
+ directory = directory or tempfile.mkdtemp(prefix="selenium_proxy_auth_")
60
+ with open(os.path.join(directory, "manifest.json"), "w") as f:
61
+ f.write(_MANIFEST)
62
+ with open(os.path.join(directory, "background.js"), "w") as f:
63
+ f.write(_BACKGROUND % fields)
64
+ return directory
65
+
66
+
67
+ def add_proxy(chrome_options, proxy_url):
68
+ """Build the extension for ``proxy_url`` and load it into ``chrome_options``.
69
+
70
+ Returns the extension directory so you can ``shutil.rmtree`` it afterwards.
71
+
72
+ opts = webdriver.ChromeOptions()
73
+ ext = add_proxy(opts, "http://USER:PASS@us.jibaoproxy.com:913")
74
+ driver = webdriver.Chrome(options=opts)
75
+ ...
76
+ shutil.rmtree(ext, ignore_errors=True)
77
+ """
78
+ directory = make_proxy_extension(proxy_url)
79
+ chrome_options.add_argument(f"--load-extension={directory}")
80
+ return directory
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: selenium-proxy-auth
3
+ Version: 0.1.0
4
+ Summary: Authenticated proxies for Selenium + Chrome without selenium-wire. Generates a proxy-auth extension on the fly.
5
+ Author-email: JiBao Proxy <support@jibaoproxy.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://jibaoproxy.com
8
+ Project-URL: Source, https://github.com/jibaoproxyofficial-pixel/selenium-proxy-auth
9
+ Keywords: selenium,proxy,proxy-authentication,chrome,web-scraping,browser-automation,residential-proxy
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Internet :: WWW/HTTP
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # selenium-proxy-auth
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
22
+ [![Python versions](https://img.shields.io/pypi/pyversions/selenium-proxy-auth.svg)](https://pypi.org/project/selenium-proxy-auth/)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ Use an **authenticated (user:pass) proxy with Selenium + Chrome** — without selenium-wire. It generates a tiny proxy-auth extension on the fly and loads it, so Chrome never shows the native auth popup that Selenium can't click.
26
+
27
+ ```bash
28
+ pip install selenium-proxy-auth
29
+ ```
30
+
31
+ ## The problem
32
+
33
+ Chrome's `--proxy-server` flag has nowhere to put a username and password. So with an authenticated proxy, Chrome throws a **native auth dialog** — which Selenium can't interact with — and every request hangs or 407s:
34
+
35
+ ```python
36
+ # ❌ no place for credentials; Chrome shows a popup Selenium can't dismiss
37
+ opts.add_argument("--proxy-server=http://user:pass@gw.example.com:913")
38
+ ```
39
+
40
+ The reliable fix is a small extension that sets `chrome.proxy` and answers `onAuthRequired` with your credentials. This package builds and loads it for you.
41
+
42
+ ## Usage
43
+
44
+ ```python
45
+ import shutil
46
+ from selenium import webdriver
47
+ from selenium_proxy_auth import add_proxy
48
+
49
+ opts = webdriver.ChromeOptions()
50
+ opts.add_argument("--headless=new")
51
+
52
+ ext = add_proxy(opts, "http://USERNAME:PASSWORD@us.jibaoproxy.com:913")
53
+
54
+ driver = webdriver.Chrome(options=opts)
55
+ try:
56
+ driver.get("https://httpbin.org/ip")
57
+ print(driver.find_element("tag name", "body").text)
58
+ finally:
59
+ driver.quit()
60
+ shutil.rmtree(ext, ignore_errors=True) # clean up the generated extension
61
+ ```
62
+
63
+ `add_proxy` returns the path to the generated extension directory so you can delete it afterwards. The extension contains your credentials in plaintext — it's written to a temp dir; don't commit it.
64
+
65
+ ## How it works
66
+
67
+ - Manifest V3 extension with the `proxy`, `webRequest`, and `webRequestAuthProvider` permissions.
68
+ - A background service worker sets `chrome.proxy.settings` to your `host:port` and returns `authCredentials` from `onAuthRequired`.
69
+ - Loaded via `--load-extension`, so it works in headless `--headless=new`. (Old `--headless` does not load extensions; use `--headless=new`.)
70
+
71
+ Need just the files (e.g. for undetected-chromedriver)? Use `make_proxy_extension(url)` to get the directory and load it yourself.
72
+
73
+ ## Rotating IPs
74
+
75
+ A rotating residential gateway hands out a new exit IP per connection from one URL — point `add_proxy` at the gateway and each fresh `webdriver.Chrome` gets a different IP. If you're still getting blocked after authenticating, the exit IP is the issue: datacenter ranges get scored as bots by ASN and [TLS fingerprint](https://jibaoproxy.com/blog/ja3-tls-fingerprint-detection-explained.html) before the page loads. We build [JiBao Proxy](https://jibaoproxy.com) for clean residential exits — 72M+ IPs, 200+ countries, sticky sessions. Works with any provider, though.
76
+
77
+ ## Related
78
+
79
+ - [Selenium & Playwright proxy authentication, explained](https://jibaoproxy.com/blog/selenium-playwright-proxy-authentication.html)
80
+ - [AdsPower / Multilogin proxy setup](https://jibaoproxy.com/blog/adspower-multilogin-proxy-setup.html)
81
+ - [Bypassing DataDome & PerimeterX in 2026](https://jibaoproxy.com/blog/datadome-perimeterx-bypass-2026.html)
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ selenium_proxy_auth/__init__.py
5
+ selenium_proxy_auth/extension.py
6
+ selenium_proxy_auth.egg-info/PKG-INFO
7
+ selenium_proxy_auth.egg-info/SOURCES.txt
8
+ selenium_proxy_auth.egg-info/dependency_links.txt
9
+ selenium_proxy_auth.egg-info/top_level.txt
10
+ tests/test_extension.py
@@ -0,0 +1 @@
1
+ selenium_proxy_auth
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,21 @@
1
+ import json
2
+ import os
3
+ from selenium_proxy_auth import make_proxy_extension
4
+
5
+
6
+ def test_extension_files_written(tmp_path):
7
+ d = make_proxy_extension("http://user:s3cret@gw.example.com:913", directory=str(tmp_path))
8
+ manifest = json.load(open(os.path.join(d, "manifest.json")))
9
+ assert manifest["manifest_version"] == 3
10
+ assert "webRequestAuthProvider" in manifest["permissions"]
11
+ bg = open(os.path.join(d, "background.js")).read()
12
+ assert 'host: "gw.example.com"' in bg
13
+ assert "port: 913" in bg
14
+ assert 'username: "user"' in bg
15
+ assert 'password: "s3cret"' in bg
16
+
17
+
18
+ def test_requires_host_and_port():
19
+ import pytest
20
+ with pytest.raises(ValueError):
21
+ make_proxy_extension("http://user:pass@hostonly")