Skip to content

Commit 189df17

Browse files
author
Dzmitry Humianiuk
authored
Merge pull request #33 from JMoravec/master
Add verify_ssl option
2 parents fa1fc86 + 29b7db7 commit 189df17

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

reportportal_client/service.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ReportPortalService(object):
103103
"""Service class with report portal event callbacks."""
104104

105105
def __init__(self, endpoint, project, token, api_base="api/v1",
106-
is_skipped_an_issue=True):
106+
is_skipped_an_issue=True, verify_ssl=True):
107107
"""Init the service class.
108108
109109
Args:
@@ -113,6 +113,7 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
113113
api_base: defaults to api/v1, can be changed to other version.
114114
is_skipped_an_issue: option to mark skipped tests as not
115115
'To Investigate' items on Server side.
116+
verify_ssl: option to not verify ssl certificates
116117
"""
117118
super(ReportPortalService, self).__init__()
118119
self.endpoint = endpoint
@@ -128,6 +129,7 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
128129
self.session.headers["Authorization"] = "bearer {0}".format(self.token)
129130
self.stack = [None]
130131
self.launch_id = None
132+
self.verify_ssl = verify_ssl
131133

132134
def terminate(self):
133135
pass
@@ -142,7 +144,7 @@ def start_launch(self, name, start_time, description=None, tags=None,
142144
"mode": mode
143145
}
144146
url = uri_join(self.base_url, "launch")
145-
r = self.session.post(url=url, json=data)
147+
r = self.session.post(url=url, json=data, verify=self.verify_ssl)
146148
self.launch_id = _get_id(r)
147149
self.stack.append(None)
148150
logger.debug("start_launch - Stack: %s", self.stack)
@@ -154,7 +156,7 @@ def _finalize_launch(self, end_time, action, status):
154156
"status": status
155157
}
156158
url = uri_join(self.base_url, "launch", self.launch_id, action)
157-
r = self.session.put(url=url, json=data)
159+
r = self.session.put(url=url, json=data, verify=self.verify_ssl)
158160
self.stack.pop()
159161
logger.debug("%s_launch - Stack: %s", action, self.stack)
160162
return _get_msg(r)
@@ -199,7 +201,7 @@ def start_test_item(self, name, start_time, item_type, description=None,
199201
url = uri_join(self.base_url, "item", parent_item_id)
200202
else:
201203
url = uri_join(self.base_url, "item")
202-
r = self.session.post(url=url, json=data)
204+
r = self.session.post(url=url, json=data, verify=self.verify_ssl)
203205

204206
item_id = _get_id(r)
205207
self.stack.append(item_id)
@@ -219,7 +221,7 @@ def finish_test_item(self, end_time, status, issue=None):
219221
}
220222
item_id = self.stack.pop()
221223
url = uri_join(self.base_url, "item", item_id)
222-
r = self.session.put(url=url, json=data)
224+
r = self.session.put(url=url, json=data, verify=self.verify_ssl)
223225
logger.debug("finish_test_item - Stack: %s", self.stack)
224226
return _get_msg(r)
225227

@@ -235,7 +237,7 @@ def log(self, time, message, level=None, attachment=None):
235237
return self.log_batch([data])
236238
else:
237239
url = uri_join(self.base_url, "log")
238-
r = self.session.post(url=url, json=data)
240+
r = self.session.post(url=url, json=data, verify=self.verify_ssl)
239241
logger.debug("log - Stack: %s", self.stack)
240242
return _get_id(r)
241243

@@ -283,7 +285,7 @@ def log_batch(self, log_data):
283285
)
284286
)]
285287
files.extend(attachments)
286-
r = self.session.post(url=url, files=files)
288+
r = self.session.post(url=url, files=files, verify=self.verify_ssl)
287289
logger.debug("log_batch - Stack: %s", self.stack)
288290
logger.debug("log_batch response: %s", r.text)
289291

reportportal_client/service_async.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ class ReportPortalServiceAsync(object):
132132

133133
def __init__(self, endpoint, project, token, api_base="api/v1",
134134
error_handler=None, log_batch_size=20,
135-
is_skipped_an_issue=True):
135+
is_skipped_an_issue=True,
136+
verify_ssl=True):
136137
"""Init the service class.
137138
138139
Args:
@@ -144,12 +145,16 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
144145
during items processing (in thread)
145146
is_skipped_an_issue: option to mark skipped tests as not
146147
'To Investigate' items on Server side.
148+
verify_ssl: option to not verify ssl certificates
147149
"""
148150
super(ReportPortalServiceAsync, self).__init__()
149151
self.error_handler = error_handler
150152
self.log_batch_size = log_batch_size
151153
self.rp_client = ReportPortalService(
152-
endpoint, project, token, api_base, is_skipped_an_issue)
154+
endpoint, project, token,
155+
api_base,
156+
is_skipped_an_issue,
157+
verify_ssl)
153158
self.log_batch = []
154159
self.supported_methods = ["start_launch", "finish_launch",
155160
"start_test_item", "finish_test_item", "log"]

0 commit comments

Comments
 (0)