Skip to content

Commit 1650b47

Browse files
authored
Merge pull request #12 from yaacov/allow-insecure-connections
Add SSLContext (context) option to HawkularMetricsClient
2 parents 484eb38 + e7e56b1 commit 1650b47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hawkular/metrics.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import time
2121
import collections
2222
import base64
23+
import ssl
2324

2425
try:
2526
import simplejson as json
@@ -87,6 +88,7 @@ def __init__(self,
8788
path='hawkular/metrics',
8889
scheme='http',
8990
cafile=None,
91+
context=None,
9092
token=None,
9193
username=None,
9294
password=None):
@@ -109,6 +111,7 @@ def __init__(self,
109111
self.path = path
110112
self.cafile = cafile
111113
self.scheme = scheme
114+
self.context = context
112115
self.token = token
113116
self.username = username
114117
self.password = password
@@ -177,7 +180,7 @@ def _http(self, url, method, data=None):
177180
req.data = data.encode('utf-8')
178181

179182
req.get_method = lambda: method
180-
res = urlopen(req)
183+
res = urlopen(req, context = self.context)
181184
if method == 'GET':
182185
if res.getcode() == 200:
183186
data = json.load(reader(res))

0 commit comments

Comments
 (0)