File tree Expand file tree Collapse file tree
python-disallowAdditionalPropertiesIfNotPresent/openapi_client
python-aiohttp/petstore_api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -309,6 +309,9 @@ def __init__(
309309 self .proxy : Optional [str ] = None
310310 """Proxy URL
311311 """
312+ self .no_proxy : Optional [str ] = None
313+ """Hosts for which to bypass the proxy
314+ """
312315 self .proxy_headers = None
313316 """Proxy headers
314317 """
Original file line number Diff line number Diff line change 1717import json
1818import re
1919import ssl
20+ from urllib .parse import urlparse
21+ from urllib .request import getproxies
2022
2123import urllib3
24+ from requests .utils import should_bypass_proxies
2225
2326from openapi_client .exceptions import ApiException , ApiValueError
2427
@@ -100,14 +103,15 @@ def __init__(self, configuration) -> None:
100103 # https pool manager
101104 self .pool_manager : urllib3 .PoolManager
102105
103- if configuration .proxy :
104- if is_socks_proxy_url (configuration .proxy ):
106+ proxy = getproxies ().get (urlparse (configuration .host ).scheme ) if configuration .proxy is None else configuration .proxy
107+ if proxy and not should_bypass_proxies (configuration .host , configuration .no_proxy ):
108+ if is_socks_proxy_url (proxy ):
105109 from urllib3 .contrib .socks import SOCKSProxyManager
106- pool_args ["proxy_url" ] = configuration . proxy
110+ pool_args ["proxy_url" ] = proxy
107111 pool_args ["headers" ] = configuration .proxy_headers
108112 self .pool_manager = SOCKSProxyManager (** pool_args )
109113 else :
110- pool_args ["proxy_url" ] = configuration . proxy
114+ pool_args ["proxy_url" ] = proxy
111115 pool_args ["proxy_headers" ] = configuration .proxy_headers
112116 self .pool_manager = urllib3 .ProxyManager (** pool_args )
113117 else :
Original file line number Diff line number Diff line change @@ -309,6 +309,9 @@ def __init__(
309309 self .proxy : Optional [str ] = None
310310 """Proxy URL
311311 """
312+ self .no_proxy : Optional [str ] = None
313+ """Hosts for which to bypass the proxy
314+ """
312315 self .proxy_headers = None
313316 """Proxy headers
314317 """
Original file line number Diff line number Diff line change 1717import json
1818import re
1919import ssl
20+ from urllib .parse import urlparse
21+ from urllib .request import getproxies
2022
2123import urllib3
24+ from requests .utils import should_bypass_proxies
2225
2326from openapi_client .exceptions import ApiException , ApiValueError
2427
@@ -100,14 +103,15 @@ def __init__(self, configuration) -> None:
100103 # https pool manager
101104 self .pool_manager : urllib3 .PoolManager
102105
103- if configuration .proxy :
104- if is_socks_proxy_url (configuration .proxy ):
106+ proxy = getproxies ().get (urlparse (configuration .host ).scheme ) if configuration .proxy is None else configuration .proxy
107+ if proxy and not should_bypass_proxies (configuration .host , configuration .no_proxy ):
108+ if is_socks_proxy_url (proxy ):
105109 from urllib3 .contrib .socks import SOCKSProxyManager
106- pool_args ["proxy_url" ] = configuration . proxy
110+ pool_args ["proxy_url" ] = proxy
107111 pool_args ["headers" ] = configuration .proxy_headers
108112 self .pool_manager = SOCKSProxyManager (** pool_args )
109113 else :
110- pool_args ["proxy_url" ] = configuration . proxy
114+ pool_args ["proxy_url" ] = proxy
111115 pool_args ["proxy_headers" ] = configuration .proxy_headers
112116 self .pool_manager = urllib3 .ProxyManager (** pool_args )
113117 else :
Original file line number Diff line number Diff line change @@ -375,6 +375,9 @@ def __init__(
375375 self .proxy : Optional [str ] = None
376376 """Proxy URL
377377 """
378+ self .no_proxy : Optional [str ] = None
379+ """Hosts for which to bypass the proxy
380+ """
378381 self .proxy_headers = None
379382 """Proxy headers
380383 """
Original file line number Diff line number Diff line change @@ -379,6 +379,9 @@ def __init__(
379379 self .proxy : Optional [str ] = None
380380 """Proxy URL
381381 """
382+ self .no_proxy : Optional [str ] = None
383+ """Hosts for which to bypass the proxy
384+ """
382385 self .proxy_headers = None
383386 """Proxy headers
384387 """
Original file line number Diff line number Diff line change 1616import json
1717import re
1818import ssl
19+ from urllib .parse import urlparse
20+ from urllib .request import getproxies
1921
2022import urllib3
23+ from requests .utils import should_bypass_proxies
2124
2225from petstore_api .exceptions import ApiException , ApiValueError
2326
@@ -99,14 +102,15 @@ def __init__(self, configuration) -> None:
99102 # https pool manager
100103 self .pool_manager : urllib3 .PoolManager
101104
102- if configuration .proxy :
103- if is_socks_proxy_url (configuration .proxy ):
105+ proxy = getproxies ().get (urlparse (configuration .host ).scheme ) if configuration .proxy is None else configuration .proxy
106+ if proxy and not should_bypass_proxies (configuration .host , configuration .no_proxy ):
107+ if is_socks_proxy_url (proxy ):
104108 from urllib3 .contrib .socks import SOCKSProxyManager
105- pool_args ["proxy_url" ] = configuration . proxy
109+ pool_args ["proxy_url" ] = proxy
106110 pool_args ["headers" ] = configuration .proxy_headers
107111 self .pool_manager = SOCKSProxyManager (** pool_args )
108112 else :
109- pool_args ["proxy_url" ] = configuration . proxy
113+ pool_args ["proxy_url" ] = proxy
110114 pool_args ["proxy_headers" ] = configuration .proxy_headers
111115 self .pool_manager = urllib3 .ProxyManager (** pool_args )
112116 else :
You can’t perform that action at this time.
0 commit comments