Allow for only turning off ssl verification for plex

pull/1900/head
FestiveKyle 9 months ago
parent 56961ccca1
commit 3e463cd048

@ -89,6 +89,7 @@ plex: # Can be individually specified per library as
clean_bundles: false
empty_trash: false
optimize: false
verify_ssl: true
tmdb: # REQUIRED for the script to run
apikey: ################################
language: en

@ -86,6 +86,9 @@
"optimize": {
"description": "true/false - If 'true', optimizes database on this Plex server",
"type": "boolean"
},
"verify_ssl": {
"type": "boolean"
}
},
"required": [

@ -719,6 +719,7 @@ class ConfigFile:
"url": check_for_attribute(self.data, "url", parent="plex", var_type="url", default_is_none=True),
"token": check_for_attribute(self.data, "token", parent="plex", default_is_none=True),
"timeout": check_for_attribute(self.data, "timeout", parent="plex", var_type="int", default=60),
"verify_ssl": check_for_attribute(self.data, "verify_ssl", parent="plex", var_type="bool", default=True),
"db_cache": check_for_attribute(self.data, "db_cache", parent="plex", var_type="int", default_is_none=True),
"clean_bundles": check_for_attribute(self.data, "clean_bundles", parent="plex", var_type="bool", default=False),
"empty_trash": check_for_attribute(self.data, "empty_trash", parent="plex", var_type="bool", default=False),
@ -1071,6 +1072,7 @@ class ConfigFile:
"url": check_for_attribute(lib, "url", parent="plex", var_type="url", default=self.general["plex"]["url"], req_default=True, save=False),
"token": check_for_attribute(lib, "token", parent="plex", default=self.general["plex"]["token"], req_default=True, save=False),
"timeout": check_for_attribute(lib, "timeout", parent="plex", var_type="int", default=self.general["plex"]["timeout"], save=False),
"verify_ssl": check_for_attribute(lib, "verify_ssl", parent="plex", var_type="bool", default=self.general["plex"]["verify_ssl"], save=False),
"db_cache": check_for_attribute(lib, "db_cache", parent="plex", var_type="int", default=self.general["plex"]["db_cache"], default_is_none=True, save=False),
"clean_bundles": check_for_attribute(lib, "clean_bundles", parent="plex", var_type="bool", default=self.general["plex"]["clean_bundles"], save=False),
"empty_trash": check_for_attribute(lib, "empty_trash", parent="plex", var_type="bool", default=self.general["plex"]["empty_trash"], save=False),

@ -435,12 +435,19 @@ class Plex(Library):
super().__init__(config, params)
self.plex = params["plex"]
self.url = self.plex["url"]
self.plex["session"] = self.config.session
if self.plex.get("verify_ssl") is False and self.config.general["verify_ssl"] is True:
logger.debug("Overriding verify_ssl to False for Plex connection")
self.plex["session"] = requests.Session()
self.plex["session"].verify = False
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
self.token = self.plex["token"]
self.timeout = self.plex["timeout"]
logger.secret(self.url)
logger.secret(self.token)
try:
self.PlexServer = PlexServer(baseurl=self.url, token=self.token, session=self.config.session, timeout=self.timeout)
self.PlexServer = PlexServer(baseurl=self.url, token=self.token, session=self.plex["session"], timeout=self.timeout)
plexapi.server.TIMEOUT = self.timeout
os.environ["PLEXAPI_PLEXAPI_TIMEOUT"] = str(self.timeout)
logger.info(f"Connected to server {self.PlexServer.friendlyName} version {self.PlexServer.version}")

Loading…
Cancel
Save