mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Add verify ssl certificate to websocket connection
This commit is contained in:
parent
9073568c0f
commit
98ffa3735b
1 changed files with 7 additions and 1 deletions
|
@ -24,6 +24,7 @@ import json
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import certifi
|
||||||
import websocket
|
import websocket
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
|
@ -145,12 +146,17 @@ def run():
|
||||||
if plexpy.CONFIG.PMS_SSL and plexpy.CONFIG.PMS_URL[:5] == 'https':
|
if plexpy.CONFIG.PMS_SSL and plexpy.CONFIG.PMS_URL[:5] == 'https':
|
||||||
uri = plexpy.CONFIG.PMS_URL.replace('https://', 'wss://') + '/:/websockets/notifications'
|
uri = plexpy.CONFIG.PMS_URL.replace('https://', 'wss://') + '/:/websockets/notifications'
|
||||||
secure = 'secure '
|
secure = 'secure '
|
||||||
|
if plexpy.CONFIG.VERIFY_SSL_CERT:
|
||||||
|
sslopt = {'ca_certs': certifi.where()}
|
||||||
|
else:
|
||||||
|
sslopt = None
|
||||||
else:
|
else:
|
||||||
uri = 'ws://%s:%s/:/websockets/notifications' % (
|
uri = 'ws://%s:%s/:/websockets/notifications' % (
|
||||||
plexpy.CONFIG.PMS_IP,
|
plexpy.CONFIG.PMS_IP,
|
||||||
plexpy.CONFIG.PMS_PORT
|
plexpy.CONFIG.PMS_PORT
|
||||||
)
|
)
|
||||||
secure = ''
|
secure = ''
|
||||||
|
sslopt = None
|
||||||
|
|
||||||
# Set authentication token (if one is available)
|
# Set authentication token (if one is available)
|
||||||
if plexpy.CONFIG.PMS_TOKEN:
|
if plexpy.CONFIG.PMS_TOKEN:
|
||||||
|
@ -165,7 +171,7 @@ def run():
|
||||||
# Try an open the websocket connection
|
# Try an open the websocket connection
|
||||||
logger.info("Tautulli WebSocket :: Opening %swebsocket." % secure)
|
logger.info("Tautulli WebSocket :: Opening %swebsocket." % secure)
|
||||||
try:
|
try:
|
||||||
plexpy.WEBSOCKET = create_connection(uri, header=header)
|
plexpy.WEBSOCKET = create_connection(uri, header=header, sslopt=sslopt)
|
||||||
logger.info("Tautulli WebSocket :: Ready")
|
logger.info("Tautulli WebSocket :: Ready")
|
||||||
plexpy.WS_CONNECTED = True
|
plexpy.WS_CONNECTED = True
|
||||||
except (websocket.WebSocketException, IOError, Exception) as e:
|
except (websocket.WebSocketException, IOError, Exception) as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue