|
10 | 10 | from zitadel_client.exceptions import ApiException, ApiValueError |
11 | 11 | from zitadel_client.rest_response import RESTResponse |
12 | 12 |
|
13 | | -SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} |
14 | 13 | RESTResponseType = urllib3.HTTPResponse |
15 | 14 |
|
16 | | - |
17 | | -def is_socks_proxy_url(url: str) -> bool: |
18 | | - if url is None: |
19 | | - return False |
20 | | - split_section = url.split("://") |
21 | | - if len(split_section) < 2: |
22 | | - return False |
23 | | - else: |
24 | | - return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES |
25 | | - |
26 | | - |
27 | 15 | class RESTClientObject: |
28 | 16 |
|
29 | 17 | def __init__(self, configuration) -> None: # type: ignore |
@@ -64,19 +52,7 @@ def __init__(self, configuration) -> None: # type: ignore |
64 | 52 |
|
65 | 53 | # https pool manager |
66 | 54 | self.pool_manager: urllib3.PoolManager |
67 | | - |
68 | | - if configuration.proxy: |
69 | | - if is_socks_proxy_url(configuration.proxy): |
70 | | - from urllib3.contrib.socks import SOCKSProxyManager |
71 | | - pool_args["proxy_url"] = configuration.proxy |
72 | | - pool_args["headers"] = configuration.proxy_headers |
73 | | - self.pool_manager = SOCKSProxyManager(**pool_args) |
74 | | - else: |
75 | | - pool_args["proxy_url"] = configuration.proxy |
76 | | - pool_args["proxy_headers"] = configuration.proxy_headers |
77 | | - self.pool_manager = urllib3.ProxyManager(**pool_args) |
78 | | - else: |
79 | | - self.pool_manager = urllib3.PoolManager(**pool_args) |
| 55 | + self.pool_manager = urllib3.PoolManager(**pool_args) |
80 | 56 |
|
81 | 57 | def request( |
82 | 58 | self, |
|
0 commit comments