Skip to content

Commit 18baeb5

Browse files
committed
add ssl_verification_enabled to streaming_specs + tests
1 parent 9e721a3 commit 18baeb5

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

plotly/plotly/plotly.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ def get_streaming_specs(self):
463463
464464
"""
465465
streaming_url = get_config()['plotly_streaming_domain']
466+
ssl_verification_enabled = get_config()['plotly_ssl_verification']
466467
ssl_enabled = 'https' in streaming_url
467468
port = self.HTTPS_PORT if ssl_enabled else self.HTTP_PORT
468469

@@ -476,6 +477,7 @@ def get_streaming_specs(self):
476477
'server': host,
477478
'port': port,
478479
'ssl_enabled': ssl_enabled,
480+
'ssl_verification_enabled': ssl_verification_enabled,
479481
'headers': headers
480482
}
481483

plotly/tests/test_core/test_stream/test_stream.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
tk = 'vaia8trjjb'
1919
config = {'plotly_domain': 'https://plot.ly',
2020
'plotly_streaming_domain': 'stream.plot.ly',
21-
'plotly_api_domain': 'https://api.plot.ly'}
21+
'plotly_api_domain': 'https://api.plot.ly',
22+
'plotly_ssl_verification': False}
2223

2324

2425
class TestStreaming(TestCase):
@@ -147,6 +148,7 @@ def test_stream_http(self):
147148
'server': 'stream.plot.ly',
148149
'port': 80,
149150
'ssl_enabled': False,
151+
'ssl_verification_enabled': False,
150152
'headers': {
151153
'Host': 'stream.plot.ly',
152154
'plotly-streamtoken': tk
@@ -158,15 +160,20 @@ def test_stream_http(self):
158160
def test_stream_https(self):
159161

160162
# If the https scheme is used in the plotly_streaming_domain, port 443
161-
# should be used for streaming and ssl_enabled should be True
163+
# should be used for streaming, ssl_enabled should be True,
164+
# and ssl_verification_enabled should equal plotly_ssl_verification
162165

163-
py.sign_in(un, ak,
164-
**{'plotly_streaming_domain': 'https://stream.plot.ly'})
166+
ssl_stream_config = {
167+
'plotly_streaming_domain': 'https://stream.plot.ly',
168+
'plotly_ssl_verification': True
169+
}
170+
py.sign_in(un, ak, **ssl_stream_config)
165171
my_stream = py.Stream(tk)
166172
expected_streaming_specs = {
167173
'server': 'stream.plot.ly',
168174
'port': 443,
169175
'ssl_enabled': True,
176+
'ssl_verification_enabled': True,
170177
'headers': {
171178
'Host': 'stream.plot.ly',
172179
'plotly-streamtoken': tk

0 commit comments

Comments
 (0)