Skip to content

Commit f63ac0d

Browse files
makes sure proxies are forcefully set in requests for testing
1 parent cfe9ea7 commit f63ac0d

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

vcert/connection_cloud.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@
1414
# limitations under the License.
1515
#
1616
import base64
17+
import os
1718
import re
1819
import time
1920

2021
import requests
22+
23+
proxies = {
24+
"http": os.environ.get('HTTP_PROXY'),
25+
"https": os.environ.get('HTTPS_PROXY'),
26+
}
27+
2128
import six.moves.urllib.parse as urlparse
2229
from nacl.public import SealedBox
2330
from six import string_types
@@ -153,6 +160,7 @@ def __init__(self, token, url=None, http_request_kwargs=None):
153160
http_request_kwargs = {'timeout': 180}
154161
elif 'timeout' not in http_request_kwargs:
155162
http_request_kwargs['timeout'] = 180
163+
http_request_kwargs['proxies'] = proxies
156164
self._http_request_kwargs = http_request_kwargs
157165

158166
def __str__(self):

vcert/connection_tpp_token.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616
import logging as log
17+
import os
1718
import re
1819
import time
1920

@@ -30,6 +31,10 @@
3031
KEY_REFRESH_TOKEN = 'refresh_token' # nosec
3132
KEY_EXPIRATION_DATE = 'expiration_date'
3233

34+
proxies = {
35+
"http": os.environ.get('HTTP_PROXY'),
36+
"https": os.environ.get('HTTPS_PROXY'),
37+
}
3338

3439
class TPPTokenConnection(AbstractTPPConnection):
3540
def __init__(self, url, user=None, password=None, access_token=None, refresh_token=None, http_request_kwargs=None):
@@ -50,6 +55,7 @@ def __init__(self, url, user=None, password=None, access_token=None, refresh_tok
5055
http_request_kwargs = {'timeout': 180}
5156
elif 'timeout' not in http_request_kwargs:
5257
http_request_kwargs['timeout'] = 180
58+
http_request_kwargs['proxies'] = proxies
5359
self._http_request_kwargs = http_request_kwargs or {}
5460

5561
def __setattr__(self, key, value):

0 commit comments

Comments
 (0)