Skip to content

Commit 554340e

Browse files
pescobarlabkey-nicka
authored andcommitted
added an option to disable ssl verification (#11)
1 parent 7af9cfd commit 554340e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

labkey/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
DISABLE_CSRF_CHECK = False # Used by tests to disable CSRF token check
2828

2929

30-
def create_server_context(domain, container_path, context_path=None, use_ssl=True, api_key=None):
30+
def create_server_context(domain, container_path, context_path=None, use_ssl=True, verify_ssl=True, api_key=None):
3131
"""
3232
Create a LabKey server context. This context is used to encapsulate properties
3333
about the LabKey server that is being requested against. This includes, but is not limited to,
@@ -36,6 +36,7 @@ def create_server_context(domain, container_path, context_path=None, use_ssl=Tru
3636
:param container_path:
3737
:param context_path:
3838
:param use_ssl:
39+
:param verify_ssl:
3940
:param api_key:
4041
:return:
4142
"""
@@ -44,6 +45,7 @@ def create_server_context(domain, container_path, context_path=None, use_ssl=Tru
4445
container_path=container_path,
4546
context_path=context_path,
4647
use_ssl=use_ssl,
48+
verify_ssl=verify_ssl,
4749
api_key=api_key
4850
)
4951

@@ -104,12 +106,15 @@ def __init__(self, **kwargs):
104106
self._context_path = kwargs.pop('context_path', None)
105107
self._domain = kwargs.pop('domain', None)
106108
self._use_ssl = kwargs.pop('use_ssl', True)
109+
self._verify_ssl = kwargs.pop('verify_ssl', True)
107110
self._api_key = kwargs.pop('api_key', None)
108111

109112
self._session = requests.Session()
110113

111114
if self._use_ssl:
112115
self._scheme = 'https://'
116+
if not self._verify_ssl:
117+
self._session.verify = False
113118
else:
114119
self._scheme = 'http://'
115120

0 commit comments

Comments
 (0)