python-proxy-headers 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- python_proxy_headers/urllib3_proxy_manager.py +18 -0
- {python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/METADATA +1 -1
- {python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/RECORD +6 -6
- {python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/WHEEL +1 -1
- {python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -3,6 +3,8 @@ from http.client import _read_headers
|
|
|
3
3
|
from urllib3.connection import HTTPSConnection
|
|
4
4
|
from urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool
|
|
5
5
|
from urllib3.poolmanager import ProxyManager
|
|
6
|
+
from urllib3.util.request import make_headers
|
|
7
|
+
from urllib3.util.url import parse_url
|
|
6
8
|
|
|
7
9
|
if sys.version_info < (3, 12, 0):
|
|
8
10
|
#####################################
|
|
@@ -128,6 +130,22 @@ class HTTPSProxyConnectionPool(HTTPSConnectionPool):
|
|
|
128
130
|
|
|
129
131
|
class ProxyHeaderManager(ProxyManager):
|
|
130
132
|
def __init__(self, *args, **kwargs):
|
|
133
|
+
# urllib3.ProxyManager does not add Proxy-Authorization from user:pass in the
|
|
134
|
+
# proxy URL; requests does via HTTPAdapter.proxy_headers(). Merge URL auth here
|
|
135
|
+
# so direct proxy_from_url() matches requests and authenticates CONNECT.
|
|
136
|
+
proxy_url = kwargs.get("proxy_url")
|
|
137
|
+
if proxy_url is None and args:
|
|
138
|
+
proxy_url = args[0]
|
|
139
|
+
proxy_headers = kwargs.get("proxy_headers")
|
|
140
|
+
merged = dict(proxy_headers or {})
|
|
141
|
+
if isinstance(proxy_url, str):
|
|
142
|
+
parsed = parse_url(proxy_url)
|
|
143
|
+
if parsed.auth and not any(
|
|
144
|
+
k.lower() == "proxy-authorization" for k in merged
|
|
145
|
+
):
|
|
146
|
+
merged.update(make_headers(proxy_basic_auth=parsed.auth))
|
|
147
|
+
if merged != dict(proxy_headers or {}):
|
|
148
|
+
kwargs["proxy_headers"] = merged
|
|
131
149
|
super().__init__(*args, **kwargs)
|
|
132
150
|
self.pool_classes_by_scheme = {"http": HTTPConnectionPool, "https": HTTPSProxyConnectionPool}
|
|
133
151
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-proxy-headers
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Handle custom proxy headers for http & https requests in various python libraries
|
|
5
5
|
Author-email: ProxyMesh <support@proxymesh.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/proxymesh/python-proxy-headers
|
|
@@ -5,9 +5,9 @@ python_proxy_headers/cloudscraper_proxy.py,sha256=6xF58QywHV4IYlC_KtXIWQTXZjE8Ce
|
|
|
5
5
|
python_proxy_headers/httpx_proxy.py,sha256=Q8tDlfl4u3fjsZZDA1zj1pbN7fiAwJ3ctFGojbqtaEo,11829
|
|
6
6
|
python_proxy_headers/pycurl_proxy.py,sha256=_JAt_o5gX7o0sRLOQXG3421mEehzBm-rhUl4c9IG5HQ,11738
|
|
7
7
|
python_proxy_headers/requests_adapter.py,sha256=CfGEEYc0eaKKNA11VbhZzv9qFVEL1uMSzAUNvidIyEU,2313
|
|
8
|
-
python_proxy_headers/urllib3_proxy_manager.py,sha256=
|
|
9
|
-
python_proxy_headers-0.2.
|
|
10
|
-
python_proxy_headers-0.2.
|
|
11
|
-
python_proxy_headers-0.2.
|
|
12
|
-
python_proxy_headers-0.2.
|
|
13
|
-
python_proxy_headers-0.2.
|
|
8
|
+
python_proxy_headers/urllib3_proxy_manager.py,sha256=ryT7QaCPb7lyQtHaP3v6MKfBerurBYrdRj4i-41ORT4,5196
|
|
9
|
+
python_proxy_headers-0.2.2.dist-info/licenses/LICENSE,sha256=i_H6fvudjqZOKkZFCIHGmbPHIxszjCAT90UJSY2OM0U,1066
|
|
10
|
+
python_proxy_headers-0.2.2.dist-info/METADATA,sha256=ltXQg143IYn7qLMgAjQihF4UJCUNurgBjSJfZPWcD1U,6288
|
|
11
|
+
python_proxy_headers-0.2.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
12
|
+
python_proxy_headers-0.2.2.dist-info/top_level.txt,sha256=Bhm-Qc6vn0DAd2Li8ZBn6KLkls2zJnM4-CtXHvIiRh8,21
|
|
13
|
+
python_proxy_headers-0.2.2.dist-info/RECORD,,
|
{python_proxy_headers-0.2.1.dist-info → python_proxy_headers-0.2.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|