def get_streaming_specs(self):
"""
Returns the streaming server, port, ssl_enabled flag, and headers.
"""
streaming_url = get_config()['plotly_streaming_domain']
ssl_verification_enabled = get_config()['plotly_ssl_verification']
ssl_enabled = 'https' in streaming_url
port = self.HTTPS_PORT if ssl_enabled else self.HTTP_PORT
# If no scheme (https/https) is included in the streaming_url, the
# host will be None. Use streaming_url in this case.
host = (six.moves.urllib.parse.urlparse(streaming_url).hostname or
streaming_url)
headers = {'Host': host, 'plotly-streamtoken': self.stream_id}
streaming_specs = {
'server': host,
'port': port,
'ssl_enabled': ssl_enabled,
'ssl_verification_enabled': ssl_verification_enabled,
'headers': headers
}
return streaming_specs
评论列表
文章目录