From c3063a77e45453f2f0f8dab1209f27d132e07d14 Mon Sep 17 00:00:00 2001 From: Blacktwin Date: Thu, 23 Aug 2018 06:38:07 -0400 Subject: [PATCH] CONFIG and SSL --- utility/refresh_next_episode.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/utility/refresh_next_episode.py b/utility/refresh_next_episode.py index f8cb245..582f5c9 100644 --- a/utility/refresh_next_episode.py +++ b/utility/refresh_next_episode.py @@ -14,14 +14,30 @@ Check Tautulli's Watched Percent in Tautulli > Settings > General ''' +import requests import sys -from plexapi.server import PlexServer +from plexapi.server import PlexServer, CONFIG # pip install plexapi -baseurl = 'http://localhost:32400' -token = 'XXXXXX' # Plex Token -plex = PlexServer(baseurl, token) +PLEX_URL = '' +PLEX_TOKEN = '' +PLEX_URL = CONFIG.data['auth'].get('server_baseurl', PLEX_URL) +PLEX_TOKEN = CONFIG.data['auth'].get('server_token', PLEX_TOKEN) + +sess = requests.Session() +# Ignore verifying the SSL certificate +sess.verify = False # '/path/to/certfile' +# If verify is set to a path to a directory, +# the directory must have been processed using the c_rehash utility supplied +# with OpenSSL. +if sess.verify is False: + # Disable the warning that the request is insecure, we know that... + import urllib3 + + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + +plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess) show_name = sys.argv[1] next_ep_num = int(sys.argv[2])