Fix requests verify ssl certificate
This commit is contained in:
parent
906f61a847
commit
dde330a704
5 changed files with 38 additions and 31 deletions
|
@ -67,15 +67,15 @@ class DownloadUtils():
|
|||
certificate must be path to certificate or 'None'
|
||||
"""
|
||||
if verifySSL is None:
|
||||
verifySSL = settings('sslverify')
|
||||
verifySSL = state.VERIFY_SSL_CERT
|
||||
if certificate is None:
|
||||
certificate = settings('sslcert')
|
||||
log.debug("Verify SSL certificates set to: %s" % verifySSL)
|
||||
log.debug("SSL client side certificate set to: %s" % certificate)
|
||||
if verifySSL != 'true':
|
||||
self.s.verify = False
|
||||
if certificate != 'None':
|
||||
certificate = state.SSL_CERT_PATH
|
||||
# Set the session's parameters
|
||||
self.s.verify = verifySSL
|
||||
if certificate:
|
||||
self.s.cert = certificate
|
||||
log.debug("Verify SSL certificates set to: %s", verifySSL)
|
||||
log.debug("SSL client side certificate set to: %s", certificate)
|
||||
|
||||
def startSession(self, reset=False):
|
||||
"""
|
||||
|
@ -177,8 +177,9 @@ class DownloadUtils():
|
|||
headerOptions = self.getHeader(options=headerOptions)
|
||||
else:
|
||||
headerOptions = headerOverride
|
||||
if settings('sslcert') != 'None':
|
||||
kwargs['cert'] = settings('sslcert')
|
||||
kwargs['verify'] = state.VERIFY_SSL_CERT
|
||||
if state.SSL_CERT_PATH:
|
||||
kwargs['cert'] = state.SSL_CERT_PATH
|
||||
|
||||
# Set the variables we were passed (fallback to request session
|
||||
# otherwise - faster)
|
||||
|
|
|
@ -46,7 +46,9 @@ STATE_SETTINGS = {
|
|||
'remapSMBphotoOrg': 'remapSMBphotoOrg',
|
||||
'remapSMBphotoNew': 'remapSMBphotoNew',
|
||||
'enableMusic': 'ENABLE_MUSIC',
|
||||
'enableBackgroundSync': 'BACKGROUND_SYNC'
|
||||
'enableBackgroundSync': 'BACKGROUND_SYNC',
|
||||
'sslverify': 'VERIFY_SSL_CERT',
|
||||
'sslcert': 'SSL_CERT_PATH'
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
@ -113,6 +115,8 @@ class KodiMonitor(Monitor):
|
|||
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
|
||||
settings('backgroundsync_saftyMargin'))
|
||||
state.SYNC_THREAD_NUMBER = int(settings('syncThreadNumber'))
|
||||
state.SSL_CERT_PATH = settings('sslcert') \
|
||||
if settings('sslcert') != 'None' else None
|
||||
# Never set through the user
|
||||
# state.KODI_PLEX_TIME_OFFSET = float(settings('kodiplextimeoffset'))
|
||||
if changed is True:
|
||||
|
|
|
@ -50,33 +50,12 @@ class LibrarySync(Thread):
|
|||
if settings('FanartTV') == 'true':
|
||||
self.fanartthread = Process_Fanart_Thread(self.fanartqueue)
|
||||
# How long should we wait at least to process new/changed PMS items?
|
||||
|
||||
self.user = userclient.UserClient()
|
||||
self.vnodes = videonodes.VideoNodes()
|
||||
self.xbmcplayer = xbmc.Player()
|
||||
|
||||
self.installSyncDone = settings('SyncInstallRunDone') == 'true'
|
||||
|
||||
state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval')) * 60
|
||||
state.SYNC_THREAD_NUMBER = int(settings('syncThreadNumber'))
|
||||
state.SYNC_DIALOG = settings('dbSyncIndicator') == 'true'
|
||||
state.ENABLE_MUSIC = settings('enableMusic') == 'true'
|
||||
state.BACKGROUND_SYNC = settings(
|
||||
'enableBackgroundSync') == 'true'
|
||||
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
|
||||
settings('backgroundsync_saftyMargin'))
|
||||
|
||||
# Show sync dialog even if user deactivated?
|
||||
self.force_dialog = True
|
||||
# Init for replacing paths
|
||||
state.REPLACE_SMB_PATH = settings('replaceSMB') == 'true'
|
||||
state.REMAP_PATH = settings('remapSMB') == 'true'
|
||||
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
||||
for arg in ('Org', 'New'):
|
||||
key = 'remapSMB%s%s' % (typus, arg)
|
||||
setattr(state, key, settings(key))
|
||||
# Just in case a time sync goes wrong
|
||||
state.KODI_PLEX_TIME_OFFSET = float(settings('kodiplextimeoffset'))
|
||||
Thread.__init__(self)
|
||||
|
||||
def showKodiNote(self, message, icon="plex"):
|
||||
|
|
|
@ -63,6 +63,10 @@ remapSMBmusicNew = None
|
|||
remapSMBphotoOrg = None
|
||||
remapSMBphotoNew = None
|
||||
|
||||
# Shall we verify SSL certificates?
|
||||
VERIFY_SSL_CERT = False
|
||||
# Do we have an ssl certificate for PKC we need to use?
|
||||
SSL_CERT_PATH = None
|
||||
# Along with window('plex_authenticated')
|
||||
AUTHENTICATED = False
|
||||
# plex.tv username
|
||||
|
|
19
service.py
19
service.py
|
@ -120,6 +120,25 @@ class Service():
|
|||
videonodes.VideoNodes().clearProperties()
|
||||
|
||||
# Init some stuff
|
||||
state.VERIFY_SSL_CERT = settings('sslverify') == 'true'
|
||||
state.SSL_CERT_PATH = settings('sslcert') \
|
||||
if settings('sslcert') != 'None' else None
|
||||
state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval')) * 60
|
||||
state.SYNC_THREAD_NUMBER = int(settings('syncThreadNumber'))
|
||||
state.SYNC_DIALOG = settings('dbSyncIndicator') == 'true'
|
||||
state.ENABLE_MUSIC = settings('enableMusic') == 'true'
|
||||
state.BACKGROUND_SYNC = settings(
|
||||
'enableBackgroundSync') == 'true'
|
||||
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
|
||||
settings('backgroundsync_saftyMargin'))
|
||||
state.REPLACE_SMB_PATH = settings('replaceSMB') == 'true'
|
||||
state.REMAP_PATH = settings('remapSMB') == 'true'
|
||||
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
||||
for arg in ('Org', 'New'):
|
||||
key = 'remapSMB%s%s' % (typus, arg)
|
||||
setattr(state, key, settings(key))
|
||||
state.KODI_PLEX_TIME_OFFSET = float(settings('kodiplextimeoffset'))
|
||||
|
||||
window('plex_minDBVersion', value="1.5.10")
|
||||
set_webserver()
|
||||
self.monitor = Monitor()
|
||||
|
|
Loading…
Reference in a new issue