Skip to content

Commit

Permalink
makes sure proxies are forcefully set in requests for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
luispresuelVenafi committed Nov 29, 2024
1 parent 50218f8 commit b9e7c83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vcert/connection_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
# limitations under the License.
#
import base64
import os
import re
import time

import requests

proxies = {
"http": os.environ.get('HTTP_PROXY'),
"https": os.environ.get('HTTPS_PROXY'),
}

import six.moves.urllib.parse as urlparse
from nacl.public import SealedBox
from six import string_types
Expand Down Expand Up @@ -153,6 +160,7 @@ def __init__(self, token, url=None, http_request_kwargs=None):
http_request_kwargs = {'timeout': 180}
elif 'timeout' not in http_request_kwargs:
http_request_kwargs['timeout'] = 180
http_request_kwargs['proxies'] = proxies
self._http_request_kwargs = http_request_kwargs

def __str__(self):
Expand Down
6 changes: 6 additions & 0 deletions vcert/connection_tpp_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
#
import logging as log
import os
import re
import time

Expand All @@ -30,6 +31,10 @@
KEY_REFRESH_TOKEN = 'refresh_token' # nosec
KEY_EXPIRATION_DATE = 'expiration_date'

proxies = {
"http": os.environ.get('HTTP_PROXY'),
"https": os.environ.get('HTTPS_PROXY'),
}

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

def __setattr__(self, key, value):
Expand Down

0 comments on commit b9e7c83

Please sign in to comment.