Skip to content

Commit bd1f5a2

Browse files
committed
SDK-826: Add support for disabling SSL verification
1 parent 84e8e54 commit bd1f5a2

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

yoti_python_sdk/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"YOTI_API_URL": "https://api.yoti.com",
1010
"YOTI_API_PORT": 443,
1111
"YOTI_API_VERSION": "v1",
12+
"YOTI_API_VERIFY_SSL": "true"
1213
}
1314

1415
main_ns = {}
@@ -28,4 +29,13 @@
2829
YOTI_API_URL, YOTI_API_PORT, YOTI_API_VERSION
2930
)
3031

31-
__all__ = ["Client", __version__]
32+
YOTI_API_VERIFY_SSL = environ.get("YOTI_API_VERIFY_SSL", DEFAULTS["YOTI_API_VERIFY_SSL"])
33+
if YOTI_API_VERIFY_SSL == "false":
34+
YOTI_API_VERIFY_SSL = False
35+
else:
36+
YOTI_API_VERIFY_SSL = True
37+
38+
__all__ = [
39+
"Client",
40+
__version__
41+
]

yoti_python_sdk/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
X_YOTI_SDK_VERSION,
2424
JSON_CONTENT_TYPE,
2525
)
26+
from . import YOTI_API_VERIFY_SSL
2627

2728
NO_KEY_FILE_SPECIFIED_ERROR = (
2829
"Please specify the correct private key file "
@@ -103,7 +104,7 @@ def make_request(self, http_method, endpoint, body):
103104

104105
url = yoti_python_sdk.YOTI_API_ENDPOINT + endpoint
105106
headers = self.__get_request_headers(endpoint, http_method, body)
106-
response = requests.request(http_method, url, headers=headers, data=body)
107+
response = requests.request(http_method, url, headers=headers, data=body, verify=YOTI_API_VERIFY_SSL)
107108
return response
108109

109110
@property
@@ -135,7 +136,7 @@ def __make_activity_details_request(
135136
path = self.__endpoint.get_activity_details_request_path(decrypted_token)
136137
url = yoti_python_sdk.YOTI_API_ENDPOINT + path
137138
headers = self.__get_request_headers(path, http_method, content)
138-
response = requests.get(url=url, headers=headers)
139+
response = requests.get(url=url, headers=headers, verify=YOTI_API_VERIFY_SSL)
139140

140141
self.http_error_handler(
141142
response, {"default": "Unsuccessful Yoti API call: {1}"}
@@ -150,7 +151,7 @@ def __make_aml_check_request(self, http_method, aml_profile):
150151
url = yoti_python_sdk.YOTI_API_ENDPOINT + path
151152
headers = self.__get_request_headers(path, http_method, aml_profile_bytes)
152153

153-
response = requests.post(url=url, headers=headers, data=aml_profile_bytes)
154+
response = requests.post(url=url, headers=headers, data=aml_profile_bytes, verify=YOTI_API_VERIFY_SSL)
154155

155156
self.http_error_handler(
156157
response, {"default": "Unsuccessful Yoti API call: {1}"}

0 commit comments

Comments
 (0)