@@ -152,6 +152,7 @@ def __init__(self, credentials, integration_name=None, timeout=None, max_retries
152
152
integration_name (str): The integration name being used.
153
153
timeout (int): The timeout value to use for HTTP requests on this connection.
154
154
max_retries (int): The maximum number of times to retry a request.
155
+ proxy_session (requests.Session) custom session to be used
155
156
**pool_kwargs: Additional arguments to be used to initialize connection pooling.
156
157
157
158
Raises:
@@ -186,8 +187,10 @@ def __init__(self, credentials, integration_name=None, timeout=None, max_retries
186
187
self .token_header = {'X-Auth-Token' : self .token , 'User-Agent' : user_agent }
187
188
if proxy_session :
188
189
self .session = proxy_session
190
+ credentials .use_custom_proxy_session = True
189
191
else :
190
192
self .session = requests .Session ()
193
+ credentials .use_custom_proxy_session = False
191
194
192
195
self ._timeout = timeout
193
196
@@ -207,7 +210,10 @@ def __init__(self, credentials, integration_name=None, timeout=None, max_retries
207
210
self .session .mount (self .server , tls_adapter )
208
211
209
212
self .proxies = {}
210
- if credentials .ignore_system_proxy : # see https://github.com/kennethreitz/requests/issues/879
213
+ if credentials .use_custom_proxy_session :
214
+ # get the custom session proxies
215
+ self .proxies = self .session .proxies
216
+ elif credentials .ignore_system_proxy : # see https://github.com/kennethreitz/requests/issues/879
211
217
# Unfortunately, requests will look for any proxy-related environment variables and use those anyway. The
212
218
# only way to solve this without side effects, is passing in empty strings for 'http' and 'https':
213
219
self .proxies = {
0 commit comments